Skip to content

Instantly share code, notes, and snippets.

@ggtmtmgg
Last active October 14, 2017 11:37
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 ggtmtmgg/5e4fc0421f2124bc69af32ac913d042d to your computer and use it in GitHub Desktop.
Save ggtmtmgg/5e4fc0421f2124bc69af32ac913d042d to your computer and use it in GitHub Desktop.
outputs random strings of various lengths
### Usage
# download or copy this file to your unix computer
# open terminal
# $ cd <path to the directory which has randostrings.rb>
# $ ruby randstrings.rb
require 'securerandom'
length = 16
4.times do
puts "a random string which is #{length} chars length"
puts SecureRandom.hex(length / 2)
length *= 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment