Crates.io | rand-wyrand |
lib.rs | rand-wyrand |
version | 0.1.0 |
source | src |
created_at | 2022-08-11 03:36:57.955551 |
updated_at | 2022-08-11 03:36:57.955551 |
description | The extremely fast WyRand PRNG for the rand ecosystem of crates. |
homepage | |
repository | https://github.com/Absolucy/rand-wyrand |
max_upload_size | |
id | 643107 |
size | 19,501 |
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)
use rand::{Rng, SeedableRng};
use rand_wyrand::WyRand;
let mut wyrand = WyRand::from_entropy();
let mut bytes = [0_u8; 64];
wyrand.fill(&mut bytes);
println!("Random bytes: {bytes:?}");
use rand::{Rng, SeedableRng};
use rand_wyrand::WyRand;
let mut wyrand = WyRand::from_entropy();
println!("Random number from 1 to 100: {}", wyrand.gen_range(1..=100));
use rand::{distributions::Alphanumeric, Rng, SeedableRng};
use rand_wyrand::WyRand;
let mut wyrand = WyRand::from_entropy();
let rand_string: String = wyrand
.sample_iter(&Alphanumeric)
.take(16)
.map(char::from)
.collect();
println!("Random string: {rand_string}")
rand-wyrand
is licensed under either the Apache
License or the MIT License, at your
choice.
License: Apache-2.0 OR MIT