talira

A Rust library for random number generation

open sourceMIT OR Apache-2.0free

rand is the Rust ecosystem's main family of crates for random number generation. It's built on a standard generator trait (rand_core::RngCore) with fast implementations of both cryptographically strong and small generators, an automatically seeded generator (rand::rng) on every std target, seeding from the getrandom crate, uniform and ranged sampling, many non-uniform distributions in rand_distr, and choosing and shuffling through rand::seq. Output is reproducible across platforms and it's partly no_std compatible. Its README says it's neither small nor primarily a cryptographic library, and points to fastrand and oorandom for something smaller.

Problems it solves

  • generate random numbers in my Rust program
  • shuffle a list or pick a random element in Rust
  • sample from a normal or other non-uniform distribution in Rust
  • a seedable random generator whose output is the same on every platform

Features

  • standard RNG trait with strong and fast small generators
  • automatically seeded thread-local generator
  • uniform, ranged and non-uniform distributions (rand_distr)
  • choose and shuffle helpers in rand::seq
  • portably reproducible output
  • partial no_std support