Skip to content

Instantly share code, notes, and snippets.

@yorzi
Created October 12, 2011 09:17
Show Gist options
  • Save yorzi/1280727 to your computer and use it in GitHub Desktop.
Save yorzi/1280727 to your computer and use it in GitHub Desktop.
random_token.rb
def random_token(number=10)
Digest::SHA1.hexdigest(Time.now.to_i.to_s)[1..number]
end
@yorzi
Copy link
Author

yorzi commented Oct 12, 2011

@namelessjon, you right, thanks! Your way is much better I think. My way relies on Time.now, but it should work correctly in my case :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment