GSL-FFI-RNG

The Random Number Generator interface

<gsl-rng-type*> Class

Type of generator.

<gsl-rng-type**> Class

A pointer to an array of random number generator types.

<gsl-rng*> Class

Random number generator.

Random number generator initialization

gsl-rng-default-type Function

Returns the default random number generator.

Signature:

gsl-rng-default-type () => (generator)

Values:
See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_default

gsl-rng-types-setup Function

Returns a pointer to an array of all available generator types. Should be called before using any other function in this module.

Signature:

gsl-rng-types-setup () => (types)

Values types:

An instance of <gsl-rng-type**>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_types_setup

gsl-rng-env-setup Function

This function reads the environment variables GSL_RNG_TYPE and GSL_RNG_SEED and uses their values to set the defaults.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_env_setup

gsl-rng-type-element Function

Returns the type of the random number generator at the given index.

Signature:

gsl-rng-type-element (types, index) => (generator)

Parameters:
  • types – An instance of <gsl-rng-type**>.

  • index – The index of the type to return.

Values:
See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_type_name

gsl-rng-alloc Function

Allocates a random number generator of the given type.

Signature:

gsl-rng-alloc (type) => (generator)

Parameters:
Values:
See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_alloc

gsl-rng-free Function

Free a random number generator.

Signature:

gsl-rng-free (generator) => ()

Parameters:
See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_free

Auxiliary functions

gsl-rng-set Function

Set the seed for the random number generator.

Signature:

gsl-rng-set (generator, seed) => ()

Parameters:
  • generator – An instance of <gsl-rng*>.

  • seed – An instance of <c-integer>. The seed for the random number generator.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_set

gsl-rng-max Function

Return the maximum value of the random number generator.

Signature:

gsl-rng-max (generator) => (max)

Parameters:
Values:
  • max – An instance of <c-integer>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_max

gsl-rng-min Function

Return the minimum value of the random number generator.

Signature:

gsl-rng-min (generator) => (min)

Parameters:
Values:
  • min – An instance of <c-integer>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_min

gsl-rng-name Function

Return the name of the random number generator.

Signature:

gsl-rng-name (generator) => (name)

Parameters:
Values:
  • name – An instance of <c-string>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_name

Sampling from a random number generator

gsl-rng-get Function

Returns a random number between the minimum and maximum value of the random number generator.

Signature:

gsl-rng-get (generator) => (number)

Parameters:
Values:
  • number – A random number between the minimum and maximum value of the random number generator as an instance of <c-double>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_get

gsl-rng-uniform Function

Returns a random number between the minimum and maximum value of the random number generator.

Signature:

gsl-rng-uniform (generator) => (number)

Parameters:
Values:
  • number – A random number between the minimum and maximum value of the random number generator as an instance of <c-double>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_uniform

gsl-rng-uniform-pos Function

Returns a random number between 0 and the maximum value of the random number generator.

Signature:

gsl-rng-uniform-pos (generator) => (number)

Parameters:
Values:
  • number – A random number between 0 and the maximum value of the random number generator as an instance of <c-double>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_uniform_pos

gsl-rng-uniform-int Function

Returns a random number between 0 and n-1 of the random number generator.

Signature:

gsl-rng-uniform-int (generator, n) => (number)

Parameters:
  • generator – An instance of <gsl-rng*>.

  • n – An instance of <c-integer>.

Values:
  • number – A random number between 0 and n-1 of the random number generator as an instance of <c-integer>.

See also:

https://www.gnu.org/software/gsl/doc/html/rng.html#c.gsl_rng_uniform_int