Random number generator (included): Difference between revisions

→‎{{header|Rust}}: add mention of how to implement other PRNGs
(→‎{{header|Rust}}: expand Rust)
(→‎{{header|Rust}}: add mention of how to implement other PRNGs)
Line 717:
=={{header|Rust}}==
Rust's <code>[https://crates.io/crates/rand rand]</code> crate offers several PRNGs. (It is also available via <code>#![feature(rustc_private)]</code>). The offering includes some cryptographically secure PRNGs: [https://docs.rs/rand/0.4/rand/isaac/index.html ISAAC] (both 32 and 64-bit variants) and [https://docs.rs/rand/0.4/rand/chacha/struct.ChaChaRng.html ChaCha20]. <code>StdRng</code> is a wrapper of one of those efficient on the current platform. The crate also provides a weak PRNG: [https://docs.rs/rand/0.4/rand/struct.XorShiftRng.html Xorshift128]. It fails TestU01, replacement is being [https://github.com/dhardy/rand/issues/60 considered]. <code>[https://docs.rs/rand/0.4/rand/fn.thread_rng.html thread_rng]</code> returns a thread local <code>StdRng</code> initialized from the OS. Other PRNGs can be created from the OS or with <code>thread_rng</code>.
 
For any other PRNGs not provided, they merely have to implement the <code>[https://docs.rs/rand/0.4/rand/trait.Rng.html Rng]</code> trait.
 
=={{header|Scala}}==