Class: Starter::Random::UniformSequence
- Defined in:
- lib/starter/random.rb
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.
102 103 104 105 106 107 |
# File 'lib/starter/random.rb', line 102 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.
100 101 102 |
# File 'lib/starter/random.rb', line 100 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
100 101 102 |
# File 'lib/starter/random.rb', line 100 def min @min end |
Instance Method Details
#next ⇒ Object
109 110 111 |
# File 'lib/starter/random.rb', line 109 def next @min + @delta*super end |