Skip to content

Instantly share code, notes, and snippets.

@hannestyden
Created February 25, 2010 10:44
Show Gist options
  • Save hannestyden/314449 to your computer and use it in GitHub Desktop.
Save hannestyden/314449 to your computer and use it in GitHub Desktop.
module RandWaltzmann # Named after my first CS prof
extend self
def string(length=8)
(0...length).map { (@__alphanums ||= [ ('a'..'z'), ('A'..'Z'), ('0'..'9') ].map { |r| r.to_a }.flatten)[rand(@__alphanums.size)] }.join
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment