Module rand.wyrand stdlib

rand.wyrand
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
3
Imported by:
1
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Imported by

  • Standard Library

Aliases

This section is empty.

Constants

#constant seed_len

pub const seed_len = 2

Sum types

This section is empty.

Functions

This section is empty.

Structs

#struct WyRandRNG

pub struct WyRandRNG {
	buffer.PRNGBuffer
mut:
	state      u64 = seed.time_seed_64()
	bytes_left int
	buffer     u64
}

WyRandRNG is a RNG based on the WyHash hashing algorithm.

#fn (&WyRandRNG) free

JavaScript
fn (mut r &WyRandRNG) free()

#fn (&WyRandRNG) seed

fn (mut rng &WyRandRNG) seed(seed_data []u32)

seed sets the seed, needs only two u32s in little-endian format as [lower, higher].

#fn (&WyRandRNG) u8

inline
fn (mut rng &WyRandRNG) u8() u8

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

#fn (&WyRandRNG) u16

inline
fn (mut rng &WyRandRNG) u16() u16

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

#fn (&WyRandRNG) u32

inline
fn (mut rng &WyRandRNG) u32() u32

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

#fn (&WyRandRNG) u64

inline
fn (mut rng &WyRandRNG) u64() u64

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

#fn (&WyRandRNG) block_size

inline
fn (mut rng &WyRandRNG) block_size() int

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

Interfaces

This section is empty.

Enums

This section is empty.