Class: GSLng::RNG Abstract
- Inherits:
-
Object
- Object
- GSLng::RNG
- Defined in:
- lib/gslng/rng/rng.rb,
lib/gslng/rng/uniform.rb,
lib/gslng/rng/gaussian.rb
Overview
This class is abstract.
You should use any of the descendant classes which implement the #sample method.
Random Number Generator class
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(generator_type = nil) ⇒ RNG
constructor
Create a Generator of the given type.
- #initialize_copy ⇒ Object
Constructor Details
#initialize(generator_type = nil) ⇒ RNG
Create a Generator of the given type
8 9 10 11 12 13 14 |
# File 'lib/gslng/rng/rng.rb', line 8 def initialize(generator_type = nil) @type = generator_type if (@type.nil?) then @type = :mt19937 end # update comment above if changed type = GSLng.backend.send(:"gsl_rng_#{@type}") @ptr = FFI::AutoPointer.new(GSLng.backend.gsl_rng_alloc(type), RNG.method(:release)) end |