Summary
mohu-random is a stub crate. Implement a seeded RNG and the three most commonly needed distributions for numerical computing.
API surface
pub struct Rng { /* seeded state */ }
impl Rng {
pub fn new(seed: u64) -> Self;
pub fn uniform(shape: &[usize], low: f64, high: f64) -> MohuResult<Buffer>;
pub fn normal(shape: &[usize], mean: f64, std: f64) -> MohuResult<Buffer>;
pub fn integers(shape: &[usize], low: i64, high: i64) -> MohuResult<Buffer>;
}
Implementation guide
- Use
rand crate (already in workspace or add it)
- Seed reproducibility: same seed must yield same output across runs
uniform: output dtype F64; high <= low returns DomainError
normal: use Box-Muller or Ziggurat; std <= 0 returns DomainError
integers: output dtype I64; high <= low returns DomainError
Acceptance criteria
Signed-off-by: Bbn08 atrancendentbeing@gmail.com
Summary
mohu-randomis a stub crate. Implement a seeded RNG and the three most commonly needed distributions for numerical computing.API surface
Implementation guide
randcrate (already in workspace or add it)uniform: output dtype F64;high <= lowreturnsDomainErrornormal: use Box-Muller or Ziggurat;std <= 0returnsDomainErrorintegers: output dtype I64;high <= lowreturnsDomainErrorAcceptance criteria
uniformvalues in [low, high) rangenormalmean and std within tolerance for large N (e.g., N=100000)integersvalues in [low, high) rangeDomainErrorfor invalid range arguments.unwrap()in library codeSigned-off-by: Bbn08 atrancendentbeing@gmail.com