File: srand.Rd

package info (click to toggle)
r-cran-igraph 0.7.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 14,280 kB
  • sloc: ansic: 150,105; cpp: 19,404; fortran: 3,777; yacc: 1,164; tcl: 931; lex: 484; makefile: 13; sh: 9
file content (35 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
\name{srand}
\alias{srand}
\title{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{
  \item{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 \code{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 \code{srand} function is
  provided to set the random seed for these packages. It simply calls
  the standard C function \code{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{
  \code{NULL}, invisibly.
}
% \references{}
\author{Gabor Csardi \email{csardi.gabor@gmail.com}}
% \seealso{}
% \examples{}