Skip to content

Instantly share code, notes, and snippets.

@jah2488
Last active August 29, 2015 13:56
Show Gist options
  • Save jah2488/8945347 to your computer and use it in GitHub Desktop.
Save jah2488/8945347 to your computer and use it in GitHub Desktop.
array of random strings of random length
ral = -> { Array.new(5) { Array.new(1..10).sample.times.map { Array('a'..'z').sample }.join } }
def array_of_random_strings_of_random_length(array_length: 5, string_length: 5, string_range: 'a'..'z')
Array.new(array_length) do
Array(1..string_length).sample.times.map do
Array(string_range).sample
end.join
end
end
#oh the joys of ruby
@jah2488
Copy link
Author

jah2488 commented Feb 12, 2014

#dont use this for password hashing or api-key generation

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