Class: ISAACGenerator

Inherits:
PRNG::ISAAC
  • Object
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

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?(RandomDistribution::Sequence.random_seed)
      seeds = [RandomDistribution::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