Class: RandomDistribution::UniformSequence
- Defined in:
- lib/redshift/util/random.rb
Constant Summary
Constants included from Math
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
Attributes inherited from Sequence
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ UniformSequence
constructor
A new instance of UniformSequence.
- #next ⇒ Object
Methods inherited from Sequence
random_pool_seed, random_seed, serial_count
Constructor Details
#initialize(opt = {}) ⇒ UniformSequence
Returns a new instance of UniformSequence.
94 95 96 97 98 99 |
# File 'lib/redshift/util/random.rb', line 94 def initialize opt = {} super @min = Float(opt[:min] || 0) @max = Float(opt[:max] || 1) @delta = @max - @min end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
92 93 94 |
# File 'lib/redshift/util/random.rb', line 92 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
92 93 94 |
# File 'lib/redshift/util/random.rb', line 92 def min @min end |
Instance Method Details
#next ⇒ Object
101 102 103 |
# File 'lib/redshift/util/random.rb', line 101 def next @min + @delta*super end |