Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. SecureRandom.uuid.gsub(/[d-]/) { |x| (x.ord + 55).chr }
  2. # => "jpkgelfndpcoadkbgidbobddifkckodalmkj"
  3.  
  4. def get_random_string(length=5)
  5. source=("a".."z").to_a + ("A".."Z").to_a
  6. key=""
  7. length.times{ key += source[rand(source.size)].to_s }
  8. return key
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement