module RujitsuRange
Public Instance Methods
random_characters()
click to toggle source
create a string of random characters whose length is one of the values in your range (3..4).random_characters # => returns a string or 3 or 4 random characters
# File lib/rujitsu/range.rb 23 def random_characters 24 self.to_random_i.random_characters 25 end
random_hex_characters()
click to toggle source
create a string of random hex characters whose length is one of the values in your range (3..4).random_hex_characters # => returns a string of 3 or 4 random hex characters
# File lib/rujitsu/range.rb 29 def random_hex_characters 30 self.to_random_i.random_hex_characters 31 end
random_letters()
click to toggle source
create a string of random letters whose length is one of the values in your range (3..4).random_letters # => returns a string or 3 or 4 random letters
# File lib/rujitsu/range.rb 11 def random_letters 12 self.to_random_i.random_letters 13 end
random_numbers(opts = {})
click to toggle source
create a string of random numbers whose length is one of the values in your range (3..4).random_numbers # => returns a string or 3 or 4 random numbers
# File lib/rujitsu/range.rb 17 def random_numbers opts = {} 18 self.to_random_i.random_numbers opts 19 end
to_random_i()
click to toggle source
pull a random element out of this range
# File lib/rujitsu/range.rb 5 def to_random_i 6 self.to_a.sort_by { rand }.first 7 end