Seedling
Seedling is a Rust crate for creating hierarchical pseudo-random number generators (PRNGs). It provides a simple way to organize RNGs into a tree-like structure, ensuring reproducible and independent random sequences.
[]
= "1.1.0"
Features
- Hierarchical PRNGs: Organize RNGs in a tree structure with independent child generators.
- Stable Outputs: Random sequences remain stable across code changes by using consistent subseeds.
- Flexible RNGs: Supports 32-bit (
TreeRng32), 64-bit (TreeRng64), and fast (TreeRngFast) PRNGs out of the box. - Standard Traits: Implements
RngCoreand integrates with therandecosystem (includingrand::Rngtrait).
Example
// `seedling` reexports `rand_core` for convenience
use ;
// Use `rand::Rng` for a higher level api
use Rng;
Provided RNG
seedling includes out of the box support for the rand_pcg generators via the following type aliases.
TreeRng32: A 32-bit RNG based onPcg32.TreeRng64: A 64-bit RNG based onPcg64.TreeRngFast: A fast RNG based onPcg64Mcg.
seedling is also easily extensible and TreeRng<T> will work with any type implementing RngCore and SeedableRng
from rand_core.