Skip to content

Instantly share code, notes, and snippets.

View uhhuhyeah's full-sized avatar

David A McClain uhhuhyeah

View GitHub Profile
chars = ("a".."z").to_a + ("1".."9").to_a
token = Array.new(8, '').collect{chars[rand(chars.size)]}.join
def create_token(len = 20)
chars = (("a".."z").to_a + ("1".."9").to_a )- %w(i o 0 1 l 0)
token = Array.new(len, '').collect{chars[rand(chars.size)]}.join
end
token = Digest::SHA1.hexdigest(Time.now.to_s.split(//).sort_by {rand}.join)
def create_token
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'
token = ''
4.times do
pos = rand(characters.length)
token += characters[pos..pos]
end
token
end