Crates.io | aporia |
lib.rs | aporia |
version | 0.1.1 |
source | src |
created_at | 2024-11-11 16:26:21.653342 |
updated_at | 2024-11-11 16:26:21.653342 |
description | A flexible random number generation library |
homepage | |
repository | https://github.com/SkuldNorniern/aporia |
max_upload_size | |
id | 1443903 |
size | 36,961 |
Aporia is a Rust library that provides implementations of various random number generators (RNGs). With Aporia, the die is cast—bringing randomness to your Rust projects!
Aporia (ἀπορία): A Greek term meaning "difficulty," "perplexity," or "impasse," reflecting the unpredictable and puzzling nature of randomness.
Add Aporia to your Cargo.toml
:
[dependencies]
aporia = "0.1.0"
Then run:
cargo build
Here's how to use different RNG backends with Aporia:
use aporia::{
backend::{LCG, MT19937_64, PCG, SplitMix64, XorShift, Xoshiro256StarStar},
Rng,
};
fn main() {
// Using PCG
let pcg = PCG::new(12345, 67890);
let mut rng1 = Rng::new(pcg);
// Using XorShift
let xorshift = XorShift::new(12345);
let mut rng2 = Rng::new(xorshift);
// Using LCG
let lcg = LCG::new(12345);
let mut rng3 = Rng::new(lcg);
// Using MT19937_64
let mt19937_64 = MT19937_64::new(12345);
let mut rng4 = Rng::new(mt19937_64);
// Using SplitMix64
let splitmix64 = SplitMix64::new(12345);
let mut rng5 = Rng::new(splitmix64);
// Using Xoshiro256StarStar
let xoshiro256starstar = Xoshiro256StarStar::new(12345);
let mut rng6 = Rng::new(xoshiro256starstar);
println!("PCG: {}", rng1.next_u64());
println!("XorShift: {}", rng2.next_u64());
println!("LCG: {}", rng3.next_u64());
println!("MT19937_64: {}", rng4.next_u64());
println!("SplitMix64: {}", rng5.next_u64());
println!("Xoshiro256StarStar: {}", rng6.next_u64());
}
A family of simple, fast, space-efficient, and statistically good algorithms for random number generation.
A class of pseudorandom number generators that use XOR and shift bitwise operations.
One of the oldest and best-known pseudorandom number generator algorithms.
A widely used pseudorandom number generator known for its high period and equidistribution properties.
A fast, non-cryptographic PRNG with a large period and good statistical properties.
A state-of-the-art generator suitable for most applications except cryptography.
Contributions are welcome! If you have ideas for improvements or encounter any issues, please open an issue or submit a pull request.
This project is licensed under the MIT License.
For any questions or suggestions, feel free to contact the project maintainer.
With Aporia, take a chance on randomness—you won't have to roll the dice on reliability!