Class: RandomGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/grammoire/util/random_generator.rb

Instance Method Summary collapse

Instance Method Details

#number_up_to(max) ⇒ Object



2
3
4
# File 'lib/grammoire/util/random_generator.rb', line 2

def number_up_to(max)
  rand(max)
end

#one_of(options) ⇒ Object



6
7
8
# File 'lib/grammoire/util/random_generator.rb', line 6

def one_of(options)
  options[number_up_to(options.size)]
end