Module Random::String
In: lib/more/facets/random.rb

Methods

Classes and Modules

Module Random::String::Self

Public Class methods

Public Instance methods

Return a random separation of the string. Default separation is by charaacter.

  "Ruby rules".at_rand(' ')  #=> ["Ruby"]

Return a random separation while removing it from the string. Default separation is by character.

  s = "Ruby rules"
  s = at_rand!(' ')  #=> "Ruby"
  s                  #=> "rules"

Return a random byte of self.

  "Ruby rules".rand_byte  #=> 121

Destructive rand_byte. Delete a random byte of self and return it.

  s = "Ruby rules"
  s.rand_byte!      #=> 121
  s                 #=> "Rub rules"

Return a random string index.

  "Ruby rules".rand_index  #=> 3

Return the string with seperated sections arranged in a random order. The default seperation is by character.

  "Ruby rules".shuffle  #=> "e lybRsuur"

In place version of shuffle.

[Validate]