This is a library that implements the WyRand PRNG for
the RngCore trait from rand
. It is completely
#![no_std]
, and does not require the Rust standard library.
WyRand is an extremely fast, stable, and solid PRNG. While not cryptographically secure, it still passes the BigCrush and practrand tests, making it a solid choice for non-secure applications. (Basically, just don't use it to like, generate cryptographic keys or passwords or whatever)
```rust use rand::{Rng, SeedableRng}; use rand_wyrand::WyRand;
let mut wyrand = WyRand::fromentropy(); let mut bytes = [0u8; 64]; wyrand.fill(&mut bytes); println!("Random bytes: {bytes:?}"); ```
```rust use rand::{Rng, SeedableRng}; use rand_wyrand::WyRand;
let mut wyrand = WyRand::fromentropy(); println!("Random number from 1 to 100: {}", wyrand.genrange(1..=100)); ```
```rust use rand::{distributions::Alphanumeric, Rng, SeedableRng}; use rand_wyrand::WyRand;
let mut wyrand = WyRand::fromentropy(); let randstring: String = wyrand .sampleiter(&Alphanumeric) .take(16) .map(char::from) .collect(); println!("Random string: {randstring}") ```
rand-wyrand
is licensed under either the Apache
License or the MIT License, at your
choice.
License: Apache-2.0 OR MIT