srand {igraph}R Documentation

Set random seed of the C library's RNG

Description

Set the random seed of the C library's RNG, for a new sequence of pseudo-random numbers.

Usage

srand(seed)

Arguments

seed

Numeric scalar, the new random seed. It must be non-negative and will be converted to an integer.

Details

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.

Value

NULL, invisibly.

Author(s)

Gabor Csardi csardi.gabor@gmail.com


[Package igraph version 0.7.0 Index]