Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Random string generator
def random_string(length=16)
source = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a
Array.new(length){|e| source[rand(source.size)]}.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.