Class: Ruckus::Mutator::Random
- Defined in:
- lib/ruckus/mutator.rb
Overview
Generate random numbers
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Random
constructor
A new instance of Random.
- #mod(i) ⇒ Object
Methods inherited from Modifier
Constructor Details
#initialize(opts = {}) ⇒ Random
Returns a new instance of Random.
223 224 225 226 227 228 229 230 |
# File 'lib/ruckus/mutator.rb', line 223 def initialize(opts={}) srand((@seed = opts[:seed])) if opts[:seed] super @max = opts[:max] || 0xFFFFFFFF if opts[:width] @max = Numeric.mask_for(opts[:width]) end end |
Instance Method Details
#mod(i) ⇒ Object
232 233 234 |
# File 'lib/ruckus/mutator.rb', line 232 def mod(i) rand(@max) end |