simplify random img function
This commit is contained in:
10
fs.go
10
fs.go
@ -51,13 +51,9 @@ func getImagesList(path string) []string {
|
||||
}
|
||||
|
||||
// Randomly choose x number of image from a given folder
|
||||
func getRandomImages(number int) []string {
|
||||
func getRandomImage() string {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
var images []string
|
||||
dir := getImagesList("/home/gator/Photos/")
|
||||
for i := 0; i < number; i++ {
|
||||
index := rand.Intn(len(dir))
|
||||
images = append(images, dir[index])
|
||||
}
|
||||
return images
|
||||
index := rand.Intn(len(dir))
|
||||
return dir[index]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user