How can I fix this code so it generates unique random letters and numbers in lower case?
api_string = (0...32).map{65.+(rand(25)).chr}.join
Here's one way to do it:
POSSIBLE = (('A'..'Z').to_a + (0..9).to_a) api_string = (0...32).map { |n| POSSIBLE.sample }.join
If you have Active Support available you can also do this to make an API-key-like string:
ActiveSupport::SecureRandom.hex(32)