Skip to content

Commit

Permalink
document thread safety for RNGs (JuliaLang#40109)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored and ElOceanografo committed May 4, 2021
1 parent 59c1ce9 commit 13cb1b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stdlib/Random/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ type, which is a wrapper over the OS provided entropy.
Most functions related to random generation accept an optional `AbstractRNG` object as first argument,
which defaults to the global one if not provided. Moreover, some of them accept optionally
dimension specifications `dims...` (which can be given as a tuple) to generate arrays of random
values.
values. In a multi-threaded program, you should generally use different RNG objects from different threads
in order to be thread-safe. However, the default global RNG is thread-safe as of Julia 1.3 (because
it internally corresponds to a per-thread RNG).

A `MersenneTwister` or `RandomDevice` RNG can generate uniformly random numbers of the following types:
[`Float16`](@ref), [`Float32`](@ref), [`Float64`](@ref), [`BigFloat`](@ref), [`Bool`](@ref),
Expand Down

0 comments on commit 13cb1b0

Please sign in to comment.