Description Usage Arguments Details Value Author(s) References Examples

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

1 2 3 4 5 6 7 8 9 10 | ```
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)
``` |

`type` |
In function |

`r` |
Instance of a random number generator. Generate this using
function |

`seed` |
Random number seed |

`length` |
Length of vector of random numbers to create |

`N` |
In function |

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.

Function `rng_alloc()`

returns an external pointer to a GSL random
number generator.

Max Bruche

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

1 2 3 | ```
r <- rng_alloc("cmrg")
rng_set(r, 100)
rng_uniform(r, 10)
``` |

```
[1] 100
[1] 0.75100266 0.27632556 0.80290789 0.79234885 0.00991752 0.90312322
[7] 0.14127554 0.44023898 0.50391344 0.88495743
```

gsl documentation built on May 29, 2017, 12:57 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.