block-pseudorand
This crate allows multi-threaded creation of pseudorandom Vec<T>
's of arbitrary length. It does this
by generating arbitrary byte vectors randomly and transmuting to the provided type.
Notes
- Generated data is not guaranteed to be cryptographically secure
- Output can be deterministic if you provide a seed
- This is very unsafe for certain types, see the warning above
Use cases
If you need a lot of random numbers quickly for something non-production critical like unit tests, this may be a good candidate. Otherwise, if you are planning to use this at runtime, or with types that are non-numeric or otherwise cannot be created from arbitrary bytes, I would recommend you to choose another, safer crate.
Usage
If you are certain the above warnings do not apply to the type you are generating, you can use this library like so:
Without Seed
use block_rand;
let random_data: = block_rand;
assert_eq!;
With Seed
use block_rand_with_seed;
// Populate this seed as you wish
let seed = ;
let random_data: = block_rand_with_seed;
assert_eq!;