You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default Source is safe for concurrent use by multiple goroutines.
This confused me because I thought the "default Source" referred to Source returned by the NewSource function. Instead, it refers to the protected internal Source used by the top-level functions.
I think the docs about default Source is pretty clear if you read it in
full.
```
Top-level functions, such as Float64 and Int, use a default shared Source
that produces a deterministic sequence of values each time a program is
run. Use the Seed function to initialize the default Source if different
behavior
is required for each run. The default Source is safe for concurrent use by
multiple goroutines.
```
It explicitly mentions the default Source is the one used by the top-level
functions.
Following Go documentation convention, anything not explicitly
documented for concurrency safety is not safe for concurrent use.
The NewSource doesn't say Source is safe for concurrent use, so
it's not.
minux
changed the title
doc: default Source safe for concurrent use
math/rand: default Source safe for concurrent use
Sep 3, 2015
The
math/rand
documentation states:This confused me because I thought the "default Source" referred to Source returned by the NewSource function. Instead, it refers to the protected internal Source used by the top-level functions.
The text was updated successfully, but these errors were encountered: