Last active
November 26, 2018 13:30
-
-
Save paniq/295babab018ba0d65ffc3ec0783d4465 to your computer and use it in GitHub Desktop.
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
even_letters = "bcdfghlmnprstwx" | |
odd_letters = "aeiou" | |
def format_uid_digit (n, level): | |
if n != 0: | |
letters = odd_letters if (level & 1) else even_letters | |
base = len(letters) | |
s = format_uid_digit(n / base, level + 1) | |
return s + letters[(n % base)] | |
return "" | |
def format_uid (uid): | |
return format_uid_digit(uid, 0) | |
import random | |
for i in range(100): | |
k = random.randrange(1000000,2000000) | |
print k, format_uid(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment