# epoch_rng
[](https://crates.io/crates/epoch_rng)
[](https://docs.rs/epoch_rng)
A lightweight psudo random number generator library for Rust featuring:
• Epoch‑seeded RNG
• Configurable Linear Congruential Generator (LCG)
• Simple API
• No external dependencies
This crate is intended for lightweight simulations, games, and experimentation where a fast and simple RNG is useful.
⚠️ Not cryptographically secure.
---
## Installation
```bash
cargo add epoch_rng
```
---
## Usage
```rust
use epoch_rng::epoch_rng::EpochRng;
fn main() {
let mut rng = EpochRng::new();
println!("u64: {}", rng.next_u64());
println!("u32: {}", rng.next_u32());
println!("f64: {}", rng.next_f64());
println!("range f64: {}", rng.gen_range(1.0, 10.0));
}
```
---
## Shuffle Example
```rust
use epoch_rng::epoch_rng::EpochRng;
fn main() {
let mut rng = EpochRng::new();
let mut data = [1,2,3,4,5];
rng.shuffle(&mut data);
println!("{:?}", data);
}
```
---
## LCG RNG
```rust
use epoch_rng::lcg_rng::LcgRng;
fn main() {
let mut rng = LcgRng::new();
println!("{}", rng.next_u64());
}
```
---
## Features
Current RNG implementations:
• `EpochRng` – seeded from system epoch time
• `LcgRng` – configurable linear congruential generator
Both support:
- `next_u64`
- `next_u32`
- `next_f64`
- range generation
- shuffling
---
## Future Plans
Possible improvements:
- `no_std` support
- additional algorithms (XorShift, PCG, Xoshiro)