Class: ISAACGenerator

Inherits:
ISAAC show all
Defined in:
lib/redshift/util/isaac.rb

Overview

Adaptor class to use ISAAC with redshift/util/random distributions. See test/test_flow_trans.rb for an example.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ISAAC

#marshal_dump, #marshal_load, #rand, #rand32, #srand

Constructor Details

#initialize(*seeds) ⇒ ISAACGenerator

Returns a new instance of ISAACGenerator.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/redshift/util/isaac.rb', line 6

def initialize(*seeds)
  super()
  if seeds.compact.empty?
    if defined?(Random::Sequence.random_seed)
      seeds = [Random::Sequence.random_seed]
    else
      seeds = [rand]
    end
  end
  @seeds = seeds
  srand(seeds)
end

Instance Attribute Details

#seedsObject (readonly)

Returns the value of attribute seeds.



19
20
21
# File 'lib/redshift/util/isaac.rb', line 19

def seeds
  @seeds
end