class ThinpXML::UniformDistribution

Attributes

start[RW]
stop[RW]

Public Class Methods

new(start, stop) click to toggle source
# File lib/thinp_xml/distribution.rb, line 24
def initialize(start, stop)
  raise "invalid range [#{start}..#{stop})" unless start < stop

  @start = start
  @stop = stop
end

Public Instance Methods

generate() click to toggle source
# File lib/thinp_xml/distribution.rb, line 31
def generate
  @start + rand(@stop - @start)
end