#random #mersenne #simd #twister #x86-simd #simd-oriented

sfmt

Rust implementation of SIMD-oriented Fast Mersenne Twister (SFMT)

11 releases (6 breaking)

0.7.0 Sep 3, 2021
0.6.0 Jul 27, 2019
0.5.0 Nov 25, 2018
0.3.0 May 31, 2018
0.2.1 Mar 9, 2018

#1933 in Algorithms

30 downloads per month
Used in 2 crates

MIT license

18KB
336 lines

sfmt

docs.rs Build Status

Rust implementation of SIMD-oriented Fast Mersenne Twister (SFMT) interface using x86-SIMD in std::arch. This is pure rust re-implementation, and tested on Windows/macOS/Linux.

Limitations

  • Supported only on x86 and x86_64 (due to original SFMT)
  • Algorithms other than MT19937 are not supported (may be fixed in future release)

License

MIT-License


lib.rs:

Rust implementation of SIMD-oriented Fast Mersenne Twister (SFMT) using stable SIMD

use rand_core::{RngCore, SeedableRng};
let mut rng = sfmt::SFMT::seed_from_u64(42);
let r = rng.next_u32();
println!("random u32 number = {}", r);

Dependencies

~115KB