-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rand int #211
Add rand int #211
Conversation
Added description of randInt function
Function added
Nice! Does rand get seeded anywhere? I don't see any call to |
Oh. Yep. I forgot about it. Going to update it |
functions.go
Outdated
@@ -199,7 +199,10 @@ var genericMap = map[string]interface{}{ | |||
} | |||
return val | |||
}, | |||
"randInt": func(min, max int) int { return rand.Intn(max-min) + min }, | |||
"randInt": func(min, max int) int { | |||
rand.Seed(time.Now().UnixNano()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done only once, preferably:
func init() {
rand.Seed(time.Now().UnixNano())
}
d5cd86b
to
73d60f5
Compare
@mholt what u think about my solution for TestShuffle? Is it correct for test? |
I don't really know why it had to change, but at a cursory glance it looks fine, as the tests appear to be passing, so, that's a good sign. |
Hi, any news on this PR? :) |
Co-authored-by: Daniel <daniel.hoherd@gmail.com>
Signed-off-by: Matt Farina <matt@mattfarina.com>
No description provided.