Skip to content

Instantly share code, notes, and snippets.

@jaehess
Created June 1, 2009 16:11
Show Gist options
  • Select an option

  • Save jaehess/121571 to your computer and use it in GitHub Desktop.

Select an option

Save jaehess/121571 to your computer and use it in GitHub Desktop.
def generate_code(len = 5)
(1..len).map { (("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a)[rand(62)] }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment