weyl

Crates.ioweyl
lib.rsweyl
version0.1.3
sourcesrc
created_at2019-08-09 12:22:17.823459
updated_at2019-08-09 14:14:05.635085
descriptionMiddle Square Weyl Sequence RNG for Rust
homepage
repositoryhttps://github.com/tidwall/weyl-rs
max_upload_size
id155350
size6,011
Josh Baker (tidwall)

documentation

README

Middle Square Weyl Sequence RNG for Rust

travis license version documentation

A new implementation of John von Neumann's middle square random number generator (RNG). A Weyl sequence is utilized to keep the generator running through a long period.

Paper

Using

This library includes a few thread-safe functions.

weyl::u64()            // generates a random u64
weyl::f64()            // generates a random f64
weyl::fill(&mut bytes) // fill byte slice with random data
weyl::seed(my_seed)    // reseed the number generator

There's also a Generator type in case you need to generate random numbers in an isolated thread. It's little faster because it avoids mutex locks.

let mut rand = weyl::Generator::new(my_seed);
println!("{}", rand.u64());             // generates a random u64

Contact

Josh Baker @tidwall

License

Weyl source code is available under the ISC License.

Commit count: 7

cargo fmt