Class: RandomDistribution::UniformSequence

Inherits:
Sequence show all
Defined in:
lib/redshift/util/random.rb

Constant Summary

Constants included from Math

Math::Infinity

Instance Attribute Summary collapse

Attributes inherited from Sequence

#generator

Instance Method Summary collapse

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

#maxObject (readonly)

Returns the value of attribute max.



92
93
94
# File 'lib/redshift/util/random.rb', line 92

def max
  @max
end

#minObject (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

#nextObject



101
102
103
# File 'lib/redshift/util/random.rb', line 101

def next
  @min + @delta*super
end