6个版本
0.2.0 | 2023年12月13日 |
---|---|
0.1.4 | 2023年12月12日 |
0.1.1 | 2023年10月23日 |
#2274 in 算法
每月47次下载
13KB
236 行
Rule30
基于细胞自动机规则30的伪随机数生成器。
特性
-
无std
- 扩展CA以获得更好的性能
用法
use rule30::prelude::*;
fn main() {
let mut ca = ExtendedCA::seed_from_u64(42);
println!("{}", ca.next_u64());
}
与rand
包一起使用
use rule30::prelude::*;
use rand::Rng;
fn main() {
let mut ca = ExtendedCA::seed_from_u64(42);
println!("{}", ca.gen::<f64>());
}
对于Python绑定,请查看rule30py
参考
依赖
~50KB