https://github.com/kemingy/rule30
Pseudo random number generator with cellular automaton rule 30.
https://github.com/kemingy/rule30
cellular-automaton prng
Last synced: 3 months ago
JSON representation
Pseudo random number generator with cellular automaton rule 30.
- Host: GitHub
- URL: https://github.com/kemingy/rule30
- Owner: kemingy
- License: apache-2.0
- Created: 2023-02-26T08:47:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T10:50:41.000Z (8 months ago)
- Last Synced: 2025-02-28T06:32:36.212Z (7 months ago)
- Topics: cellular-automaton, prng
- Language: Rust
- Homepage:
- Size: 46.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rule30
[](https://github.com/kemingy/rule30/actions/workflows/rust.yml)
[](https://crates.io/crates/rule30)
[](https://docs.rs/rule30)
[](https://pypi.org/project/rule30py)Pseudo random number generator with cellular automaton rule 30.
## Features
- [x] `no_std`
- [x] Extend CA for better performance## Usage
```rust
use rule30::prelude::*;fn main() {
let mut ca = ExtendedCA::seed_from_u64(42);
println!("{}", ca.next_u64());
}
```To work with `rand` crate:
```rust
use rule30::prelude::*;
use rand::Rng;fn main() {
let mut ca = ExtendedCA::seed_from_u64(42);
println!("{}", ca.gen::());
}
```For Python binding, check [rule30py](python/)
## Reference
- Wolfram [Rule30](https://reference.wolfram.com/language/tutorial/RandomNumberGeneration.html#830168163)
- Wolfram [ExtendedCA](https://reference.wolfram.com/language/tutorial/RandomNumberGeneration.html#18361715)