ax-rnd
Fast and lightweight random number generator library and CLI tool for Rust.
- Small single-state RNG
- Fast bulk operations
- Pure Rust implementation
no_stdsupport- Installable CLI tool
Installation
Library
[]
= "0.1"
CLI
Quick Start
Convenience API
use ;
let n = u64;
let ok = bool;
let token = alphanumeric;
let url = base64url;
let mut buf = ;
fill;
Seeded RNG
use rng;
let mut rng = rng;
let x = rng.next_u64;
let y = rng.next_u32;
let f = rng.next_f64;
Bounded Numbers
use rng;
let mut rng = rng;
let x = rng.bounded_u64;
let y = rng.bounded_u32;
Random Strings
use rng;
let mut rng = rng;
let alpha = rng.alpha;
let token = rng.token;
Bulk Operations
use rng;
let mut rng = rng;
let mut bytes = ;
rng.fill_bytes;
let mut u64s = ;
rng.fill_u64;
State Management
use AxRng;
let mut rng = new;
let state = rng.state;
let restored = from_raw;
let other = rng.split;
rng.reseed;
Top-level Helpers
use ax_rnd;
let x = random_u64;
let token = token;
let bounded = bounded_u64;
CLI Usage
| Command | Description |
|---|---|
bytes |
Generate random bytes |
alpha |
Generate alphanumeric string |
token |
Generate URL-safe token |
shuffle |
Shuffle input lines |
u64 |
Generate random numbers |
uuid |
Generate UUID v4 |
CLI Examples
Notes
- Deterministic when using fixed seeds
- Portable pure Rust implementation
- Suitable for fast non-cryptographic randomness
- Supports
no_std
Links
- Crate: https://crates.io/crates/ax-rnd
- Docs: https://docs.rs/ax-rnd
- Rust: https://www.rust-lang.org
License
MIT