Skip to content

Instantly share code, notes, and snippets.

@jbgutierrez
Created February 7, 2009 15:52
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 jbgutierrez/59913 to your computer and use it in GitHub Desktop.
Save jbgutierrez/59913 to your computer and use it in GitHub Desktop.
Magnus Holm’s solution
# Generate a random string of length 4 or more consisting of only the following
set of characters: a-z, A-Z, 0-9
(0..4).map{rand(?z).chr[/[^_\W]/]||redo}.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment