SetPackageSeed: Set RNG Seed

SetPackageSeedR Documentation

Set RNG Seed

Description

Set the initial seed of the package or stream.

Usage

.lec.SetPackageSeed(seed)
.lec.SetSeed (name, seed)

Arguments

name

a character string giving the name of the stream.

seed

a vector of six integers. If it is shorter, the seed is extended to the length of 6 by default values 12345. If it is longer, it is truncated to the length of 6 by eliminating the last elements.

Details

.lec.SetPackageSeed sets the the starting state of the next stream to be created. If there are no streams yet, it is the initial seed of the RNG. .lec.SetSeed sets the seed of a specific stream.

A state of each stream is given by three integer vectors of length 6: Ig gives the initital state of the stream, Bg gives the starting state of the substream that contains the current state, Cg gives the current state. Function .lec.SetPackageSeed sets Cg, Bg and Ig to the value of seed. Function .lec.SetSeed sets Ig to seed. L'Ecuyer recommends to use the ResetStream functions instead of SetSeed.

Value

The (possibly modified) seed that has been used.

See Also

ResetNextSubstream

Examples

# Set the seed of the first stream
.lec.SetPackageSeed(1:6)

# Create the first stream and print out its state
.lec.CreateStream("A")
.lec.WriteStateFull("A")

# Create two more streams
.lec.CreateStream(c("B", "C"))
.lec.WriteStateFull(c("A", "B", "C"))

# Cet the seed of the next stream and create it
.lec.SetPackageSeed(rep(5678, 6))
.lec.CreateStream("D")
.lec.WriteStateFull(c("A", "B", "C", "D"))


hanase/rlecuyer documentation built on April 5, 2023, 10:44 p.m.