fixed rng seed to only be called once at initilization

This commit is contained in:
2020-06-10 00:31:39 -05:00
parent 8fc0d3062b
commit 0df7326c1c

View File

@@ -150,9 +150,6 @@ func get_redditbooru_image(sub string) <-chan string{
return return
} }
// randomize the seed for the random int
rand.Seed(time.Now().UnixNano())
// get a random number for the image // get a random number for the image
outlen,err := getArrayLen(out) outlen,err := getArrayLen(out)
random_img := rand.Intn(outlen) random_img := rand.Intn(outlen)
@@ -198,9 +195,6 @@ func get_imgur_image(sub string) <-chan string {
return return
} }
// randomize the seed for the random int
rand.Seed(time.Now().UnixNano())
// get a random number for the image // get a random number for the image
//outlen, _ := getArrayLen(out) //outlen, _ := getArrayLen(out)
//random_img := rand.Intn(outlen) //random_img := rand.Intn(outlen)
@@ -244,9 +238,6 @@ func get_subreddit_image(sub string) <-chan string {
return return
} }
// randomize the seed for the random int
rand.Seed(time.Now().UnixNano())
// make sure we aren't grabbing a text post by cylcing through looking for an image // make sure we aren't grabbing a text post by cylcing through looking for an image
limit64, _ := jsonparser.GetInt(out, "data", "dist") limit64, _ := jsonparser.GetInt(out, "data", "dist")
limit := int(limit64) // convert from int64 to int limit := int(limit64) // convert from int64 to int