Rng

From gsl v1.9-2
0th

Percentile

Random numbers generation

Random number generation with the Gnu Scientific Library, as per the reference manual section 17

Keywords
distribution, datagen
Usage
rng_alloc(type)
rng_clone(r)
rng_name(r)
rng_max(r)
rng_min(r)
rng_set(r, seed)
rng_get(r, length)
rng_uniform(r, length)
rng_uniform_int(r, N, length)
rng_uniform_pos(r, length)
Arguments
type
In function rng_alloc(), type of random number generator. This argument is taken to be a character string which is matched to the names of the random number generators given in the GSL manual section 17.9, with
r
Instance of a random number generator. Generate this using function rng_alloc().
seed
Random number seed
length
Length of vector of random numbers to create
N
In function rng_uniform_int(), upper bound of uniform distribution
Details

These are wrappers for the random number generator functions from the GSL http://www.gnu.org/software/gsl with arguments corresponding to those from the library. Calling rng_free is not necessary as R performs garbage collection automatically.

The functions that return random numbers (rng_get, rng_uniform, rng_uniform_int, rng_uniform_pos) take an extra argument that specifies the length of the vector of random numbers to be returned.

Value

• Function rng_alloc() returns an external pointer to a GSL random number generator.

References

http://www.gnu.org/software/gsl

Aliases
• Rng
• rng
• rng_alloc
• rng_clone
• rng_max
• rng_min
• rng_name
• rng_set
• rng_get
• rng_uniform
• rng_uniform_int
• rng_uniform_pos
Examples
r <- rng_alloc("cmrg")
rng_set(r, 100)
rng_uniform(r, 10)
Documentation reproduced from package gsl, version 1.9-2, License: GPL-2

Community examples

Looks like there are no examples yet.