Return to Snippet

Revision: 315
at July 9, 2006 10:44 by ishikawa


Initial Code
require 'enumerator'

def random_string(length=10, s="")
  length.enum_for(:times).inject(s) do |result, index|
    s << rand(93) + 33 
  end
end

Initial URL


Initial Description
This method generates random (and printable) ascii characters.

Initial Title
Random ASCII characters generator

Initial Tags
ruby, text

Initial Language
Ruby