Browse Source

GetWord

master
Elis Axelsson 5 years ago
parent
commit
0fa3a2c06c
  1. 19
      src/WorstCaptcha/GetWord.go

19
src/WorstCaptcha/GetWord.go

@ -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