Created
          December 10, 2014 21:29 
        
      - 
      
 - 
        
Save mattupstate/a6dd35ec335b426eae55 to your computer and use it in GitHub Desktop.  
    python url62 implementation
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import string | |
| import uuid | |
| alphabet = string.digits + string.ascii_letters | |
| def base62_encode(n): | |
| ret = '' | |
| while n > 0: | |
| ret = alphabet[n % 62] + ret | |
| n /= 62 | |
| return ret | |
| def url62(): | |
| return base62_encode(uuid.uuid4().int) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment