MT¶
A Mersenne Twister. This is a non-cryptographic random number generator. This should only be used for legacy applications that require a Mersenne Twister, otherwise use Rand.
class ref MT is
Random ref
Implements¶
- Random ref
Constructors¶
create¶
Create with the specified seed. Returned values are deterministic for a given seed.
new ref create(
x: U64 val = 5489,
y: U64 val = 0)
: MT ref^
Parameters¶
Returns¶
- MT ref^
Public Functions¶
next¶
A random integer in [0, 2^64)
fun ref next()
: U64 val
Returns¶
- U64 val
has_next¶
fun tag has_next()
: Bool val
Returns¶
- Bool val
u8¶
fun ref u8()
: U8 val
Returns¶
- U8 val
u16¶
fun ref u16()
: U16 val
Returns¶
- U16 val
u32¶
fun ref u32()
: U32 val
Returns¶
- U32 val
u64¶
fun ref u64()
: U64 val
Returns¶
- U64 val
u128¶
fun ref u128()
: U128 val
Returns¶
- U128 val
ulong¶
fun ref ulong()
: ULong val
Returns¶
- ULong val
usize¶
fun ref usize()
: USize val
Returns¶
- USize val
i8¶
fun ref i8()
: I8 val
Returns¶
- I8 val
i16¶
fun ref i16()
: I16 val
Returns¶
- I16 val
i32¶
fun ref i32()
: I32 val
Returns¶
- I32 val
i64¶
fun ref i64()
: I64 val
Returns¶
- I64 val
i128¶
fun ref i128()
: I128 val
Returns¶
- I128 val
ilong¶
fun ref ilong()
: ILong val
Returns¶
- ILong val
isize¶
fun ref isize()
: ISize val
Returns¶
- ISize val
int_fp_mult[optional N: ((U8 val | U16 val | U32 val | U64 val | U128 val | ULong val | USize val) & Real[N] val)]¶
fun ref int_fp_mult[optional N: ((U8 val | U16 val | U32 val |
U64 val | U128 val | ULong val |
USize val) & Real[N] val)](
n: N)
: N
Parameters¶
- n: N
Returns¶
- N
int[optional N: ((U8 val | U16 val | U32 val | U64 val | U128 val | ULong val | USize val) & Real[N] val)]¶
fun ref int[optional N: ((U8 val | U16 val | U32 val |
U64 val | U128 val | ULong val |
USize val) & Real[N] val)](
n: N)
: N
Parameters¶
- n: N
Returns¶
- N
int_unbiased[optional N: ((U8 val | U16 val | U32 val | U64 val | U128 val | ULong val | USize val) & Real[N] val)]¶
fun ref int_unbiased[optional N: ((U8 val | U16 val | U32 val |
U64 val | U128 val | ULong val |
USize val) & Real[N] val)](
n: N)
: N
Parameters¶
- n: N
Returns¶
- N
real¶
fun ref real()
: F64 val
Returns¶
- F64 val
shuffle[A: A]¶
fun ref shuffle[A: A](
array: Array[A] ref)
: None val
Parameters¶
- array: Array[A] ref
Returns¶
- None val