Class: GSLng::RNG::Uniform
- Inherits:
-
GSLng::RNG
- Object
- GSLng::RNG
- GSLng::RNG::Uniform
- Defined in:
- lib/gslng/rng/uniform.rb
Instance Attribute Summary (collapse)
- - (Object) ptr readonly
Instance Method Summary (collapse)
-
- (Uniform) initialize(min, max, generator_type = nil)
constructor
Creates a new Uniform distribution with values in [min,max).
-
- (Float) sample
(also: #get)
Obtain a sample from this distribution.
Methods inherited from GSLng::RNG
Constructor Details
- (Uniform) initialize(min, max, generator_type = nil)
Creates a new Uniform distribution with values in [min,max)
10 11 12 13 |
# File 'lib/gslng/rng/uniform.rb', line 10 def initialize(min, max, generator_type = nil) super(generator_type) @min,@max = min,max end |
Instance Attribute Details
- (Object) ptr (readonly)
4 5 6 |
# File 'lib/gslng/rng/uniform.rb', line 4 def ptr @ptr end |
Instance Method Details
- (Float) sample Also known as: get
Obtain a sample from this distribution
17 18 19 |
# File 'lib/gslng/rng/uniform.rb', line 17 def sample GSLng.backend.gsl_ran_flat(self.ptr, @min, @max) end |