Class: Ab::Indexer::Randomizer::OneEight
- Inherits:
-
Object
- Object
- Ab::Indexer::Randomizer::OneEight
- Defined in:
- lib/ab/indexer.rb
Instance Method Summary collapse
-
#initialize(seed) ⇒ OneEight
constructor
A new instance of OneEight.
- #rand(value) ⇒ Object
Constructor Details
#initialize(seed) ⇒ OneEight
Returns a new instance of OneEight.
59 60 61 |
# File 'lib/ab/indexer.rb', line 59 def initialize(seed) srand(seed) end |
Instance Method Details
#rand(value) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/ab/indexer.rb', line 63 def rand(value) if value.kind_of?(Range) first = value.first last = value.last - first return Kernel::rand(last) + first else Kernel::rand(value) end end |