Ruby Block to Create Random Token String Without Offending
Billy Heaton
1 min read
def random_token
characters = 'BCDFGHJKLMNPQRSTVWXYZbcdfghjkmnpqrstvwxyz23456789-_'
temp_token = ''
srand
TOKEN_LENGTH.times do
pos = rand(characters.length)
temp_token += characters[pos..pos]
end
temp_token
end