#cellular-automata #rng #numbers #pseudo #generator #rule #ca

no-std rule30

Pseudo random number generator with cellular automaton rule 30

6 releases

0.2.0 Dec 13, 2023
0.1.4 Dec 12, 2023
0.1.1 Oct 23, 2023

#2418 in Algorithms

Apache-2.0

13KB
236 lines

Rule30

Rust crates.io docs.rs

Pseudo random number generator with cellular automaton rule 30.

Features

  • no_std
  • Extend CA for better performance

Usage

use rule30::prelude::*;


fn main() {
    let mut ca = ExtendedCA::seed_from_u64(42);
    println!("{}", ca.next_u64());
}

To work with rand crate:

use rule30::prelude::*;
use rand::Rng;


fn main() {
    let mut ca = ExtendedCA::seed_from_u64(42);
    println!("{}", ca.gen::<f64>());
}

For Python binding, check rule30py

Reference

Dependencies

~48KB