Browse Source

GetWord

master
Elis Axelsson 4 years ago
parent
commit
0fa3a2c06c
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      src/WorstCaptcha/GetWord.go

+ 19
- 0
src/WorstCaptcha/GetWord.go View File

@ -0,0 +1,19 @@
package WorstCaptcha
import (
"fmt"
"io/ioutil"
"os"
"math/rand"
"strings"
)
func GetRandomWord() string {
dir, _ := os.Getwd()
files, _ := ioutil.ReadDir(dir + "/images/")
file := files[rand.Intn(len(files))].Name()
return strings.Split(file, ".")[0]
}

Loading…
Cancel
Save