Crates.io | prng |
lib.rs | prng |
version | 0.1.1 |
source | src |
created_at | 2017-08-17 20:05:36.515413 |
updated_at | 2017-10-21 22:24:17.173619 |
description | pseudo random number generator |
homepage | https://gitlab.com/nathanfaucett/rs-prng |
repository | https://gitlab.com/nathanfaucett/rs-prng.git |
max_upload_size | |
id | 27920 |
size | 8,294 |
pseudo random number generator
extern crate prng;
extern crate rng_trait;
use rng_trait::Rng;
use prng::Prng;
fn main() {
// seeds from an address of a local variable
let mut random = Prng::new();
// some random unsigned integer
// random.set_seed(24564764657);
println!("x = {:?}", random.next()); // usize number between 0 and usize MAX
println!("y = {:?}", random.next_f32()); // f32 between 0 and 1
println!("z = {:?}", random.next_f64()); // f64 between 0 and 1
}