Skip to content

rand.splitmix64 #

Constants #

const seed_len = 2

struct SplitMix64RNG #

struct SplitMix64RNG {
	state      u64 = seed.time_seed_64()
	bytes_left int
	buffer     u64

SplitMix64RNG ported from

fn (SplitMix64RNG) seed #

fn (mut rng SplitMix64RNG) seed(seed_data []u32)

seed sets the seed of the accepting SplitMix64RNG to the given data in little-endian format (i.e. lower 32 bits are in [0] and higher 32 bits in [1]).

fn (SplitMix64RNG) u8 #

fn (mut rng SplitMix64RNG) u8() u8

byte returns a uniformly distributed pseudorandom 8-bit unsigned positive byte.

fn (SplitMix64RNG) u16 #

fn (mut rng SplitMix64RNG) u16() u16

u16 returns a pseudorandom 16bit int in range [0, 2¹⁶).

fn (SplitMix64RNG) u32 #

fn (mut rng SplitMix64RNG) u32() u32

u32 returns a pseudorandom 32bit int in range [0, 2³²).

fn (SplitMix64RNG) u64 #

fn (mut rng SplitMix64RNG) u64() u64

u64 returns a pseudorandom 64bit int in range [0, 2⁶⁴).

fn (SplitMix64RNG) block_size #

fn (mut rng SplitMix64RNG) block_size() int

block_size returns the number of bits that the RNG can produce in a single iteration.

fn (SplitMix64RNG) free #

fn (mut rng SplitMix64RNG) free()

free should be called when the generator is no longer needed