Class: Ab::Indexer::Randomizer

Inherits:
Object
  • Object
show all
Defined in:
lib/ab/indexer.rb

Defined Under Namespace

Classes: OneEight

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seed) ⇒ Randomizer

Returns a new instance of Randomizer.



44
45
46
47
48
49
50
# File 'lib/ab/indexer.rb', line 44

def initialize(seed)
  if RUBY_VERSION =~ /^1.8/
    @randomizer = OneEight.new(seed)
  else
    @randomizer = Random.new(seed)
  end
end

Instance Attribute Details

#randomizerObject (readonly)

Returns the value of attribute randomizer.



42
43
44
# File 'lib/ab/indexer.rb', line 42

def randomizer
  @randomizer
end

Instance Method Details

#rand(value) ⇒ Object



52
53
54
# File 'lib/ab/indexer.rb', line 52

def rand(value)
  randomizer.rand(value)
end