-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
math/rand: randFloat64() gives the same result irrespective of the number of times run #13718
Comments
Never mind: false alarm, just luck of sleep got me not to realize that since we use the same source all the time, the results are always deterministic. |
From the package docs: "Top-level functions, such as Float64 and Int, use a
|
In the docs at https://golang.org/pkg/math/rand/#Float64, it says

However, I ran tests on both the playground http://play.golang.org/p/oK5GR_9Z_N and my computer
and it always gave me the same result 0.6046602879796196 no matter how many times I ran this. I found this out when testing out a program that simulates different sleep times to simulate contention for resources.
My test was:
And from the playground

That is the exact same result I got from nacl and darwin.
The text was updated successfully, but these errors were encountered: