Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SecureRandom.uuid.gsub(/[d-]/) { |x| (x.ord + 55).chr }
- # => "jpkgelfndpcoadkbgidbobddifkckodalmkj"
- def get_random_string(length=5)
- source=("a".."z").to_a + ("A".."Z").to_a
- key=""
- length.times{ key += source[rand(source.size)].to_s }
- return key
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement