| srand {igraph} | R Documentation |
Set the random seed of the C library's RNG, for a new sequence of pseudo-random numbers.
srand(seed)
seed |
Numeric scalar, the new random seed. It must be non-negative and will be converted to an integer. |
Note that this function has nothing to do with R's random number
generator, see set.seed for that.
Some package (e.g. ngspatial) use internal C code and generate random
numbers using the standard C library's built-in random number
generator instead of using R's RNGs. The srand function is
provided to set the random seed for these packages. It simply calls
the standard C function srand, with the supplied integer seed
value.
Note that the standard C library's RNGs are typically of very bad quality, and also slower than R's RNGs. It is not worth using them, really, other than taking over some legacy C code that already uses them, and that would be difficult to rewrite to use R's RNGs.
NULL, invisibly.
Gabor Csardi csardi.gabor@gmail.com