### Install TestU01 Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Instructions to clone, configure, compile, and install the TestU01 library. Set the TESTU01_PREFIX environment variable to the installation directory. ```sh git clone https://github.com/umontreal-simul/TestU01-2009.git cd TestU01-2009 ./configure --prefix=$HOME/.local/testu01 # run ./bootstrap first if configure is missing make -j && make install ``` -------------------------------- ### Install PractRand Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Steps to download, compile, and install PractRand for statistical testing. Ensure the RNG_TEST environment variable is set to the compiled executable. ```sh curl -LO https://downloads.sourceforge.net/project/pracrand/PractRand-pre0.95.zip unzip PractRand-pre0.95.zip -d PractRand && cd PractRand g++ -std=c++14 -c src/*.cpp src/RNGs/*.cpp src/RNGs/other/*.cpp -O3 -Iinclude -pthread ar rcs libPractRand.a *.o g++ -std=c++14 -O3 -Iinclude tools/RNG_test.cpp libPractRand.a -pthread -o RNG_test ``` -------------------------------- ### Install iai-callgrind-runner Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Install the iai-callgrind-runner binary, ensuring the version matches the iai-callgrind dependency in the project. ```sh cargo install --version 0.16.1 iai-callgrind-runner ``` -------------------------------- ### Run All iai-callgrind Benchmarks Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Execute all iai-callgrind benchmarks for the callgrind harness. ```sh cargo bench --bench callgrind ``` -------------------------------- ### List Available Generators Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Display a list of all supported generators for the testing harness. ```sh just list ``` -------------------------------- ### Run PractRand Tests Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Execute PractRand tests on rapidrand with varying volumes and configurations. Use 'just practrand rapidrand' for a standard test, 'just practrand-rev rapidrand' for bit-reversed streams, and 'just practrand-interleave rapidrand' for inter-stream correlation. ```sh # PractRand on rapidrand, doubling volume up to 16 TB (Ctrl-C any time): just practrand rapidrand # Bit-reversed stream (PractRand and TestU01 test high bits less thoroughly than low bits): just practrand-rev rapidrand # Inter-stream correlation: 256 adjacent seeds, interleaved: just practrand-interleave rapidrand # Quick 4 GB pass across every RNG for side-by-side comparison: just practrand-sweep ``` -------------------------------- ### rapidrand-cat Help Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md View available flags for rapidrand-cat, including options for seed, mode, streams, bit-reversal, and limiting output. ```sh rapidrand-cat --help ``` -------------------------------- ### Run TestU01 Tests Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Execute TestU01 batteries on rapidrand. Use 'just testu01 rapidrand smallcrush' for a quick test or 'just testu01 rapidrand bigcrush' for the full BigCrush battery. The bit-reversed stream can be tested with 'just testu01-rev rapidrand bigcrush'. ```sh # TestU01 batteries (the stub is compiled on first use): just testu01 rapidrand smallcrush just testu01 rapidrand bigcrush just testu01-rev rapidrand bigcrush # bit-reversed BigCrush ``` -------------------------------- ### Add Dependencies for RapidRng and Rand Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand/README.md Add the rand and rapidrand crates to your Cargo.toml file to use RapidRng. ```toml [dependencies] rand = "0.10" rapidrand = "0.1" ``` -------------------------------- ### Run Competing PRNGs Source: https://github.com/hoxxep/rapidrand/blob/main/TESTING.md Use the same testing harness to evaluate other pseudo-random number generators like fastrand and xoshiro256++. ```sh # Run competing PRNGs through the same harness: just practrand fastrand just testu01 xoshiro256++ bigcrush ``` -------------------------------- ### Run iai-callgrind Benchmarks with Filter Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Filter and run iai-callgrind benchmarks by specifying a benchmark ID, such as 'rapidrand'. ```sh cargo bench --bench callgrind -- 'rapidrand' ``` -------------------------------- ### Run Quick Criterion Benchmarks Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Perform a quick smoke test of the rng harness with reduced warm-up and measurement times. ```sh cargo bench --bench rng -- --warm-up-time 0.2 --measurement-time 0.5 --sample-size 10 ``` -------------------------------- ### Run Full Criterion Benchmarks Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Execute the complete set of Criterion benchmarks for the rng harness. ```sh cargo bench --bench rng ``` -------------------------------- ### RapidRng Internal Mixing Algorithm Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand/README.md Illustrates the internal mixing process of RapidRng, involving a Weyl counter and a 128-bit multiplication followed by XOR folding. ```rust // Weyl counter: odd increment → full 2^64 period state = state.wrapping_add(RAPID_SECRET_ADD); // 128-bit multiply, XORing a random-looking constant to the second operand let product = (state as u128) * ((state ^ RAPID_SECRET_XOR) as u128); // "Fold" the high and low halves of the resulting u128 together via XOR output = (product >> 64) ^ (product as u64) as u64; ``` -------------------------------- ### Seed RapidRng from a Fixed Value for Reproducibility Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand/README.md Create a reproducible random number stream by seeding RapidRng with a specific u64 value using `seed_from_u64`. ```rust use rand::{RngExt, SeedableRng}; use rapidrand::RapidRng; let mut rng = RapidRng::seed_from_u64(42); let x: u32 = rng.random(); ``` -------------------------------- ### Run Criterion Benchmarks for a Specific Workload Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand-bench/README.md Filter and run Criterion benchmarks for a specific workload or generator, such as 'u64/rapidrand'. ```sh cargo bench --bench rng -- 'u64/rapidrand' ``` -------------------------------- ### Seed RapidRng from Rand's Thread-Local RNG Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand/README.md Initialize RapidRng using rand's `from_rng` for general-purpose randomness. This requires the RngExt trait for `.random()` and `.random_range()` methods. ```rust use rand::{RngExt}; use rapidrand::RapidRng; let mut rng: RapidRng = rand::make_rng(); let coin: bool = rng.random(); let roll = rng.random_range(1..=6); let x: u32 = rng.random(); ``` -------------------------------- ### Use Standalone RapidRng Function Source: https://github.com/hoxxep/rapidrand/blob/main/rapidrand/README.md Utilize the `rapidrng` function directly for generating random numbers while manually managing the state. ```rust use rapidrand::rapidrng; let mut state: u64 = 42; let x = rapidrng(&mut state); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.