Skip to content

Commit

Permalink
Clarify AbstractRNG documentation (JuliaLang#41875)
Browse files Browse the repository at this point in the history
* Clarify AbstractRNG documentation

clean up the section a bit.
* make the exported types a bulleted list
* point out that `MersenneTwister` shouldn't be used except for backwards compatability
* explicitly mention `DeviceRandom` is what to use as a secure random generator.

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Rafael Fourquet <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Jameson Nash <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Jameson Nash <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Jameson Nash <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Rafael Fourquet <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Jameson Nash <[email protected]>

* Update stdlib/Random/docs/src/index.md

Co-authored-by: Jameson Nash <[email protected]>

Co-authored-by: Rafael Fourquet <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
Co-authored-by: Viral B. Shah <[email protected]>
  • Loading branch information
4 people authored Nov 17, 2021
1 parent 7fcc854 commit 65a6bca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions stdlib/Random/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ Random number generation in Julia uses the [Xoshiro256++](https://prng.di.unimi.
by default, with per-`Task` state.
Other RNG types can be plugged in by inheriting the `AbstractRNG` type; they can then be used to
obtain multiple streams of random numbers.
Besides the default `TaskLocalRNG` type, the `Random` package also provides `MersenneTwister`,
`RandomDevice` (which exposes OS-provided entropy), and `Xoshiro` (for explicitly-managed
Xoshiro256++ streams).

The PRNGs (pseudorandom number generators) exported by the `Random` package are:
* `TaskLocalRNG`: a token that represents use of the currently active Task-local stream, deterministically seeded from the parent task, or by `RandomDevice` (with system randomness) at program start
* `Xoshiro`: generates a high-quality stream of random numbers with a small state vector and high performance using the Xoshiro256++ algorithm
* `RandomDevice`: for OS-provided entropy. This may be used for cryptographically secure random numbers (CS(P)RNG).
* `MersenneTwister`: an alternate high-quality PRNG which was the default in older versions of Julia, and is also quite fast, but requires much more space to store the state vector and generate a random sequence.

Most functions related to random generation accept an optional `AbstractRNG` object as first argument.
Some also accept dimension specifications `dims...` (which can also be given as a tuple) to generate
Expand Down

0 comments on commit 65a6bca

Please sign in to comment.