Class: Ab::Indexer::Randomizer
- Inherits:
-
Object
- Object
- Ab::Indexer::Randomizer
- Defined in:
- lib/ab/indexer.rb
Defined Under Namespace
Classes: OneEight
Instance Attribute Summary collapse
-
#randomizer ⇒ Object
readonly
Returns the value of attribute randomizer.
Instance Method Summary collapse
-
#initialize(seed) ⇒ Randomizer
constructor
A new instance of Randomizer.
- #rand(value) ⇒ Object
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
#randomizer ⇒ Object (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 |