Class: Fathom::Distributions::DiscreteUniform
- Inherits:
-
Object
- Object
- Fathom::Distributions::DiscreteUniform
- Extended by:
- SharedMethods
- Defined in:
- lib/fathom/distributions/discrete_uniform.rb
Class Method Summary collapse
-
.rand(size) ⇒ Object
Bounded from 0 to size - 1.
- .rng ⇒ Object
Class Method Details
.rand(size) ⇒ Object
Bounded from 0 to size - 1
10 11 12 13 14 15 16 |
# File 'lib/fathom/distributions/discrete_uniform.rb', line 10 def rand(size) value = get_rand(size) while value < 0 or value >= size value = get_rand(size) end value end |
.rng ⇒ Object
5 6 7 |
# File 'lib/fathom/distributions/discrete_uniform.rb', line 5 def rng @rng ||= GSL::Rng.alloc(GSL::Rng::MT19937_1999, Kernel.rand(100_000)) end |