Initialize the Random Number Seed

Share:

Description

This routine will initialize .Random.seed to the desired seed, continue the current seed, or if none exists, set via the clock time.

Usage

1
initRandomSeed(startSeed = NA, runQuiet = TRUE, ...)

Arguments

startSeed

NULL or NA: default to current stream, unless .Random.seed does not exit, in which case the seed is set from the system clock time; otherwise, specify a scalar seed value start a new stream.

runQuiet

TRUE: no feedback; FALSE: show some results.

...

Not used, for gobbling arguments only.

Details

The default uniform RNG in R is“Mersenne-Twister” which produces a ‘seed set’ when initialized. This seed set seems to be initialized to postion 624 so that the next draw will change the seed set (and hence the position to 1). Subsequently it will take 624 more draws to change the seed set, to a new one &c. So what is returned by default from this function is a vector of length 626.

Value

The newly set seed or current seed invisibly.

Author(s)

Jeffrey H. Gove

See Also

.Random.seed, set.seed

Examples

1
2
3
4
5
6
7
## Not run: 
initRandomSeed()
initRandomSeed(12)
rm(.Random.seed)
initRandomSeed(NULL)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.