| Module | Random::StringExtensions |
| In: |
lib/standard/facets/random.rb
|
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"
Destructive rand_byte. Delete a random byte of self and return it.
s = "Ruby rules" s.rand_byte! #~> 121 s #~> "Rub rules"