7 ms·
to_hex does not seem to be in the standard library, but these will work and are rather elegant to get a short random string. Thanks, Patrick! rand(16**16).to
by lacerus 14y ago
to_hex does not seem to be in the standard library, but these will work and are rather elegant to get a short random string. Thanks, Patrick!
rand(16**16).to_s(16)
rand(16**16).to_s(36)
- earless1 14y agohttp://www.ruby-doc.org/stdlib-1.9.3/libdoc/securerandom/rdoc/SecureRandom.html http://www.ruby-doc.org/stdlib-1.9.3/libdoc/securerandom/rdo...