> module
std::random
random number generation
use std::random; feature random in the browser
std::random generates random values with rand's thread-local generator, a cryptographically secure generator seeded from the OS.
> functions
#
bool() -> boolA random boolean.
A random integer in the inclusive range [min, max]. min greater than max is a runtime error.
> examples
use std::random;
use std::io;
fn main() {
io::println("dice: {}", random::int(1, 6));
io::println("coin: {}", random::bool());
let items = ["a", "b", "c"];
io::println("pick: {}", random::choice(items));
io::println("shuffled: {}", random::shuffle(items));
}