Skip to content

Instantly share code, notes, and snippets.

@ishikawa
Created July 26, 2008 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishikawa/2582 to your computer and use it in GitHub Desktop.
Save ishikawa/2582 to your computer and use it in GitHub Desktop.
Random ASCII Characters
require 'enumerator'
def random_string(length=10, s="")
length.enum_for(:times).inject(s) do |result, index|
s << rand(93) + 33
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment