Method: Chars::CharSet#random_string

Defined in:
lib/chars/char_set.rb

#random_string(length, **kwargs) ⇒ String

Creates a String containing randomly selected characters from the Chars::CharSet.

Parameters:

  • length (Integer, Array, Range)

    The length of the String of random characters.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (**kwargs):

  • :random (Random, SecureRandom)

    The random number generator to use.

Returns:

  • (String)

    The String of randomly selected characters.

See Also:



351
352
353
# File 'lib/chars/char_set.rb', line 351

def random_string(length,**kwargs)
  random_chars(length,**kwargs).join
end