#cellular-automata #rng

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

#1355 in Algorithms

Download history 71/week @ 2024-03-01 14/week @ 2024-03-08 18/week @ 2024-03-15 28/week @ 2024-03-29

122 downloads per month

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

~50KB