SyncRNG-class: A Reference Class for SyncRNG

Description Fields Methods Examples

Description

A Reference Class for SyncRNG

Fields

seed

The seed for the random number generator

state

The current state of the RNG, should not be modified by the user

Methods

initialize(..., seed = 0)

Initialize the RNG using the C function R_syncrng_seed

rand()

Generate a single random float in the range [0, 1)

randbelow(n)

Generate a random integer below a given number

randi()

Generate a single random 32-bit integer

shuffle(x)

Randomly shuffle a provided array of values

Examples

1
2
3
s <- SyncRNG(seed=123456)
for (i in 1:10)
  cat(s$randi(), '\n')

SyncRNG documentation built on May 30, 2017, 6:06 a.m.