2024-09-06 08:20:10 +00:00
|
|
|
|
# rand_testsuite
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
A Testsuite for random number generators. It implements NIST 800-22.
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
It is intended to be more as a smoketest to ensure that random number generation isn’t completely broken.
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
## Crate Features
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
rand_testsuite defines the following features:
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
- `std`: Uses the `std` library’s maths routines instead of a freestanding pure-rust implementation.
|
|
|
|
|
- `rand_core`: Allows you to directly test `RngCore` trait implementations. Enables allocations.
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
## Getting Started
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
This is how you may use this crate to evaluate a random number generator (requires `rand_core`!)
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
```rust,ignore
|
|
|
|
|
let mut rng = rand::thread_rng();
|
|
|
|
|
assert!(CombinedRandomTest::default().evaluate_rng(&mut rng).unwrap_or_default() > 0.01);
|
|
|
|
|
```
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
### Installing
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
You can add this library to your crate with the following command:
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
```sh,ignore
|
|
|
|
|
cargo add rand_testsuite --dev
|
|
|
|
|
```
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
This makes the dependency available in testsuites.
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
|
|
|
|
## Running the tests
|
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
```sh,ignore
|
|
|
|
|
cargo test
|
|
|
|
|
nix flake check .
|
|
|
|
|
```
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
|
|
|
|
## Built With
|
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
- [Contributor Covenant](https://www.contributor-covenant.org/) - Used for the Code of Conduct
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
|
|
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code
|
|
|
|
|
of conduct, and the process for submitting pull requests to us.
|
|
|
|
|
|
|
|
|
|
## Versioning
|
|
|
|
|
|
|
|
|
|
We use [Semantic Versioning](http://semver.org/) for versioning. For the versions
|
|
|
|
|
available, see the [tags on this
|
|
|
|
|
repository](https://github.com/PurpleBooth/a-good-readme-template/tags).
|
|
|
|
|
|
|
|
|
|
## Authors
|
|
|
|
|
|
2024-09-06 08:20:10 +00:00
|
|
|
|
- **Charlotte 🦝 Delenk** [DarkKirb](https://lotte.chir.rs)
|
2024-09-05 13:45:23 +00:00
|
|
|
|
|
|
|
|
|
See also the list of
|
2024-09-06 08:20:10 +00:00
|
|
|
|
[contributors](https://git.chir.rs/ProcyOS/rand_testsuite/activity/contributors)
|
2024-09-05 13:45:23 +00:00
|
|
|
|
who participated in this project.
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
Licensed under either of
|
|
|
|
|
|
|
|
|
|
* Apache License, Version 2.0
|
|
|
|
|
[LICENSE-APACHE](LICENSE-APACHE)
|
|
|
|
|
* MIT license
|
|
|
|
|
[LICENSE-MIT](LICENSE-MIT)
|
|
|
|
|
|
|
|
|
|
at your option.
|