XorShift128Plus

[Source]

This is an implementation of xorshift+, as detailed at:

http://xoroshiro.di.unimi.it

This should only be used for legacy applications that specifically require XorShift128Plus, otherwise use Rand.

class ref XorShift128Plus is
  Random ref

Implements

Constructors

from_u64

[Source]

Use seed x to seed a SplitMix64 and use this to initialize the 128 bits of state.

new ref from_u64(
  x: U64 val = 5489)
: XorShift128Plus ref^

Parameters

  • x: U64 val = 5489

Returns

create

[Source]

Create with the specified seed. Returned values are deterministic for a given seed.

new ref create(
  x: U64 val = 5489,
  y: U64 val = 0)
: XorShift128Plus ref^

Parameters

  • x: U64 val = 5489
  • y: U64 val = 0

Returns

Public Functions

next

[Source]

A random integer in [0, 2^64)

fun ref next()
: U64 val

Returns

has_next

fun tag has_next()
: Bool val

Returns

u8

fun ref u8()
: U8 val

Returns

u16

fun ref u16()
: U16 val

Returns

u32

fun ref u32()
: U32 val

Returns

u64

fun ref u64()
: U64 val

Returns

u128

fun ref u128()
: U128 val

Returns

ulong

fun ref ulong()
: ULong val

Returns

usize

fun ref usize()
: USize val

Returns

i8

fun ref i8()
: I8 val

Returns

i16

fun ref i16()
: I16 val

Returns

i32

fun ref i32()
: I32 val

Returns

i64

fun ref i64()
: I64 val

Returns

i128

fun ref i128()
: I128 val

Returns

ilong

fun ref ilong()
: ILong val

Returns

isize

fun ref isize()
: ISize val

Returns

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

shuffle[A: A]

fun ref shuffle[A: A](
  array: Array[A] ref)
: None val

Parameters

Returns

© 2016-2020, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/random-XorShift128Plus