Crates.io | rand_mt |
lib.rs | rand_mt |
version | 4.2.2 |
source | src |
created_at | 2020-03-15 23:47:22.01643 |
updated_at | 2023-06-02 17:40:21.187003 |
description | Reference Mersenne Twister random number generators. |
homepage | https://github.com/artichoke/rand_mt |
repository | https://github.com/artichoke/rand_mt |
max_upload_size | |
id | 219042 |
size | 176,480 |
Implements a selection of Mersenne Twister random number generators.
A very fast random number generator of period 219937-1. (Makoto Matsumoto, 1997).
The Mersenne Twister algorithms are not suitable for cryptographic uses, but are ubiquitous. See the Mersenne Twister website. A variant of Mersenne Twister is the default PRNG in Ruby.
This crate optionally depends on rand_core
and implements RngCore
on the
RNGs in this crate.
Add this to your Cargo.toml
:
[dependencies]
rand_mt = "4.2.2"
Then create a RNG like:
use rand_mt::Mt64;
let mut rng = Mt64::new_unseeded();
assert_ne!(rng.next_u64(), rng.next_u64());
rand_mt
is no_std
compatible. rand_mt
has several optional features that
are enabled by default:
rand_core
. Activating this
feature implements RngCore
and SeedableRng
on the RNGs in this crate.std::error::Error
impls on error types in this crate.Mersenne Twister requires approximately 2.5 kilobytes of internal state. To make
the RNGs implemented in this crate practical to embed in other structs, you may
wish to store the RNG in a Box
.
This crate requires at least Rust 1.47.0. This version can be bumped in minor releases.
rand_mt
is distributed under the terms of either the
MIT License or the
Apache License (Version 2.0).
rand_mt
is derived from rust-mersenne-twister
@ 1.1.1
which is Copyright
(c) 2015 rust-mersenne-twister developers.