fastrand
fastrand copied to clipboard
A simple and fast random number generator
The `choose_multiple` function chooses multiple elements from an iterable, using the reservoir sampling algorithm. It is useful for sampling numbers from a list and generating a list of random numbers...
I am thinking if we can remove the internal mutability in `Rng(Cell)` by just using `Rng` and implementing methods with `fn ...(&mut self)`. This behaviour is more consistent with the...
In Cargo.toml, you have these lines of "code" `[target.'cfg(target_arch = "wasm32")'.dependencies] instant = "0.1" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] instant = { version = "0.1", features = ["wasm-bindgen"] } wasm-bindgen-test = "0.3"...
`Cell` is not `Send` thus it cannot be used as struct field in async environment. I tried to implement cursor, which needs to have its' data shuffled in a deterministic...
Randomly consistently shows up as a major bottleneck in my application. My basic problem is that I want to retrieve a lot of random elements of a Vec. I noticed...
I'm not sure if this is considered a breaking change, but all my tests started failing because my seeded generators started returning different values. I suspect this will also impact...
Currently, floats only generate in a range of 0..1 It's pretty easy to convert it in the user side to a specific range, but is there a reason why there...
This fails, but I think it should not. ~~~rust let mut rng_tx = fastrand::Rng::new(); let mut rng_rx = rng_tx.clone(); assert!(rng_tx.get_seed() == rng_rx.get_seed()); ~~~
Fix issue as reported https://github.com/smol-rs/fastrand/issues/36 This is same as pull request [#37](https://github.com/smol-rs/fastrand/pull/37) , but have test in test folder.
Because the first step of wyrand is an addition with a constant, a non-zero seed is not required