module Lottery

add wrapper for allowing configuration of random number generator

Public Class Methods

rand( arg=nil ) click to toggle source
# File lib/copycats.rb, line 57
def self.rand( arg=nil )
  if arg.is_a? Integer
    random.rand( arg )  ## max (number) = arg
  else
    random.rand     ## between 0.0 and 1.0 (as floating point number)
  end
end
random() click to toggle source
# File lib/copycats.rb, line 49
def self.random
  @random ||= Random.new
end
random=(value) click to toggle source
# File lib/copycats.rb, line 53
def self.random=(value)
  @random = value
end