Skip to content

Instantly share code, notes, and snippets.

@dbi
Created November 2, 2010 20:38
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 dbi/660257 to your computer and use it in GitHub Desktop.
Save dbi/660257 to your computer and use it in GitHub Desktop.
Random string
rand(32**8).to_s(32) # => "kff09q5l"
@dbi
Copy link
Author

dbi commented Dec 1, 2010

If you want to make sure its exactly 8 characters use this:
rand(32**8).to_s(32).rjust(8, "0")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment