module VV::RandomMethods::ClassMethods

Public Instance Methods

character(*args, capitals: false) click to toggle source
# File lib/vv/random_methods.rb, line 42
def character *args, capitals: false
  String.letters_and_numbers(capitals: capitals)
    .sample(*args, random: SecureRandom)
end
default_charset() click to toggle source
# File lib/vv/random_methods.rb, line 23
def default_charset
  36
end
identifier(length=nil, charset_radix: nil) click to toggle source
# File lib/vv/random_methods.rb, line 27
def identifier length=nil, charset_radix: nil
  length ||= self.random_identifier_default_length

  charset_radix ||= self.default_charset
  largest_digit   = (charset_radix - 1).to_s charset_radix

  start  = ( largest_digit * ( length - 1 ) ).to_i charset_radix
  start += 1

  finish = ( largest_digit * ( length     ) ).to_i charset_radix
  range  = start..finish

  SecureRandom.random_number(range).to_s charset_radix
end
vv_included?() click to toggle source
# File lib/vv/random_methods.rb, line 19
def vv_included?
  true
end