# set.seed

0th

Percentile

##### Seeding Random Variate Generators

set.seed in the simEd package allows the user to simultaneously set the initial seed for both the stats and simEd variate generators.

##### Usage
set.seed(seed, kind = NULL, normal.kind = NULL)
##### Arguments
seed

a single value, interpreted as an integer, or NULL (see 'Details')

kind

character or NULL. This is passed verbatim to base::set.seed.

normal.kind

character or NULL. This is passed verbatim to base::set.seed.

##### Details

This function intentionally masks the base::set.seed function, allowing the user to simultaneously set the initial seed for the stats variate generators (by explicitly calling base::set.seed) and for the simEd variate generators (by explicitly setting up 10 streams using the rstream.mrg32k3a generator from the rstream package).

Any call to set.seed re-initializes the seed for the stats and simEd generators as if no seed had been set. If called with seed = NULL, both the stats and simEd variate generators are re-initialized using a random seed based on the system clock.

If the user wishes to set the seed for the stats generators without affecting the seeds of the simEd generators, an explicit call to base::set.seed can be made.

Note that once set.seed is called, advancing the simEd generator state using any of the stream-based simEd variate generators will not affect the state of the non-stream-based stats generators, and vice-versa.

As soon as the simEd package is attached (i.e., when simEd is the parent of the global environment), simEd::set.seed becomes the default for a call to set.seed. When the simEd package is detached, base::set.seed will revert to the default.

##### Value

set.seed returns NULL, invisibly, consistent with base::set.seed.

base::set.seed

• set.seed
##### Examples
# NOT RUN {
set.seed(8675309)
rexp(3, rate = 2)  # explicit call of stats::rexp

set.seed(8675309)
vexp(3, rate = 2)  # also uses stats::rexp

set.seed(8675309)
vexp(3, rate = 2, stream = 1) # uses rstream and stats::qexp
vexp(3, rate = 2, stream = 2)
rexp(3, rate = 2) # explicit call of stats::rexp, starting with seed 8675309

set.seed(8675309)
vexp(1, rate = 2, stream = 1) # uses rstream and stats::qexp
vexp(1, rate = 2, stream = 2)
vexp(1, rate = 2, stream = 1)
vexp(1, rate = 2, stream = 2)
vexp(1, rate = 2, stream = 1)
vexp(1, rate = 2, stream = 2)
vexp(3, rate = 2)             # calls stats::rexp, starting with seed 8675309
# }

Documentation reproduced from package simEd, version 1.0.3, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.