help set seed
-------------------------------------------------------------------------------
Title
[R] set seed -- Specify initial value of random-number seed
Syntax
set seed {#|code}
Description
set seed # specifies the initial value of the random-number seed used by
the runiform() function. # should be a positive integer. You may also
specify code to indicate a previous internal state.
set seed code specifies a string that records the state of the
random-number generator runiform(). You can obtain the current state of
the random-number generator from c(seed).
Examples
Setup
. clear all
Specify initial value of random-number seed
. set seed 339487731
Create variable random containing uniformly distributed pseudorandom
numbers on the interval [0,1)
. generate random = runiform()
Create variable normal containing normally distributed random numbers
with mean 0 and standard deviation 1
. generate normal = rnormal()
Also see
Manual: [R] set seed
Help: [R] set, [D] functions