Class: ERV::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/erv/distribution.rb

Constant Summary collapse

DEFAULT_SEED =
12345

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Distribution

Returns a new instance of Distribution.



6
7
8
9
10
11
12
13
14
15
# File 'lib/erv/distribution.rb', line 6

def initialize(opts={})
  # use provided RNG or create a new one
  if opts[:rng]
    @rng = opts[:rng]
  elsif opts[:seed]
    @rng = Random.new(opts[:seed])
  else
    @rng = Random.new(DEFAULT_SEED)
  end
end