GSL::Rng.new([rng_type, seed])
This method returns a GSL::Rng object of a random number generator of type rng_type with a seed seed. These two arguments can be omitted, and the generator 'gsl_rng_mt19937' and a seed 0 are used as defaults. GSL provides a number of types of random number generator, one can choose one with a constant integer GSL::RNG_xxx, as
See GSL manual for the complete list. This demonstrates how to use this class,
require 'gsl' r = GSL::Rng.new(GSL::Random::TAUS, 1) r2 = GSL::Rng.new(GSL::Random::RAN0, 2) p r.get <- get an integer p r2.uniform <- get a float of [0, 1)
A generator of the type gsl_rng_taus is created with a seed 1. The method get returns a random integer. The methods uniform returns a floating number uniformly distributed in the range [0, 1).
GSL::Rng.env_setup()
GSL::Rng#set(s)
GSL::Rng#get
GSL::Rng#uniform
GSL::Rng#uniform_pos
GSL::Rng#uniform_int(n)
GSL::Rng#name
GSL::Rng#max
GSL::Rng#min