Method: Wpxf::Utility::Text.rand_alpha

Defined in:
lib/wpxf/utility/text.rb

.rand_alpha(length, casing = :mixed) ⇒ String

Generate a random alpha string.

Parameters:

  • length (Integer)

    the number of characters to include.

  • casing (Symbol) (defaults to: :mixed)

    the casing to use for the alpha characters. Possible values are :mixed, :upper and :lower.

Returns:

  • (String)

    a random alpha string.



34
35
36
# File 'lib/wpxf/utility/text.rb', line 34

def self.rand_alpha(length, casing = :mixed)
  Array.new(length) { alpha_ranges(casing).sample }.join
end