Skip to content

Instantly share code, notes, and snippets.

@tamouse
Created July 13, 2014 03:03
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 tamouse/ffa0365102ae520fdefc to your computer and use it in GitHub Desktop.
Save tamouse/ffa0365102ae520fdefc to your computer and use it in GitHub Desktop.
doing something like an airline confirmation code with securerandom
[1] pry(main)> require 'securerandom'
=> true
[2] pry(main)> SecureRandom.hex(6).upcase
=> "123B1EEF6F4C"
[3] pry(main)> SecureRandom.hex(3).upcase
=> "917522"
[4] pry(main)> SecureRandom.hex(3).upcase
=> "3EE4B5"
[5] pry(main)> SecureRandom.hex(3).upcase
=> "2188BB"
[6] pry(main)> SecureRandom.hex(3).upcase
=> "04556C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment