Skip to content
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

tour: not deterministic rand number as noted in the tour description #1448

Closed
fanxia opened this issue Feb 17, 2023 · 1 comment
Closed

tour: not deterministic rand number as noted in the tour description #1448

fanxia opened this issue Feb 17, 2023 · 1 comment

Comments

@fanxia
Copy link

fanxia commented Feb 17, 2023

Context: https://go.dev/tour/basics/1

In the section package, there is Note: The environment in which these programs are executed is deterministic, so each time you run the example program rand.Intn will return the same number. in the description. However, I got different numbers run the example program every time.

@crisman
Copy link

crisman commented Feb 18, 2023

I think this is the 1.20 change that "automatically seeds the global random number generator"
https://go.dev/doc/go1.20#math/rand

Probably just remove the last two paragraphs on that page, "Note: ..." and the parenthetical after that.

crisman added a commit to crisman/golang_website that referenced this issue Feb 20, 2023
With go 1.20 "math/rand package now automatically seeds the global random
number generator" (https://go.dev/doc/go1.20#math/rand) and we do not need
the appengine specific note that the Go Playground environment for the tour
programs is deterministic.

As the note is specific to the appengine version (i.e. it is already not shown
in the Go offline tour) it should be fine to just remove the text.

Fixes golang/tour#1448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants