class VoucherCode::Helpers::Randomize
Public Class Methods
random_element(array)
click to toggle source
# File lib/voucher_code/helpers/randomize.rb, line 9 def random_element(array) array[random_int(0, array.length - 1)] end
random_int(min, max)
click to toggle source
# File lib/voucher_code/helpers/randomize.rb, line 5 def random_int(min, max) (rand * (max - min + 1)).floor + min end