#random #simd #mersenne #twister #algorithm #x86-simd

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

#1929 in Algorithms

Download history 6/week @ 2024-01-07 7/week @ 2024-01-14 14/week @ 2024-02-18 52/week @ 2024-02-25 26/week @ 2024-03-03 23/week @ 2024-03-10 13/week @ 2024-03-17 2/week @ 2024-03-24 109/week @ 2024-03-31

153 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