Last active
October 14, 2017 11:37
outputs random strings of various lengths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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