-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/playground: result not cached #58324
Comments
cc @@toothrot |
I think this is to be expected, 1.20 now automatically randomly seeds numbers for us, where in 1.19, the seed would always be 1 and print this number in each run, it is not related to cache I believe 5577006791947779410 (this number is printed in every version below 1.20) https://go.dev/play/p/qCp3lxxXQ_A?v=goprev |
@mrwormhole the playground is, or at least was, to my knowledge supposed to be deterministic so that results don't change over time and can be cached (even sleeps are actually cached and emulated in the browser!) |
I'm not sure what is to be expected from the playground in this regard either. |
Thanks for the report. Caching does indeed appear to be broken, though I don't think this is specific to 1.20. I can take a look. |
This is the expected behaviour in Go 1.20. Please take a look at the Go 1.20 minor library changes.
If you add the func init() {
rand.Seed(1)
} |
@roger2hk This is not about the change in the behaviour of math/rand but about the playground not caching the program execution. |
What version of Go are you using (
go version
)?1.20 on the playground
Does this issue reproduce with the latest release?
With 1.20, but not 1.19
What operating system and processor architecture are you using (
go env
)?Playground
What did you do?
Ran the code from @rsc new blog post (link) multiple times.
Whole file:
What did you expect to see?
The same result when running multiple times, as written at the top of the file:
What did you see instead?
Different results.
The text was updated successfully, but these errors were encountered: