Created
November 19, 2018 15:54
-
-
Save paniq/698e0ceaef7f07ef9ebacf1984e30abf to your computer and use it in GitHub Desktop.
This file contains 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
# partial katakana romaji, base 65 | |
syllables = [ | |
"ka", "ki","ku","ke","ko", #"kya","kyu","kyo", | |
"sa","su","se","so", #"sha","shu","sho","shi", | |
"ta","te","to", #"cha","chu","cho","chi","tsu", | |
"na","ni","nu","ne","no", #"nya","nyu","nyo", | |
"ha","hi","fu","he","ho", #"hya","hyu","hyo", | |
"ma","mi","mu","me","mo", #"mya","myu","myo", | |
"ya","yu","yo", | |
"ra","ri","ru","re","ro", #"rya","ryu","ryo", | |
"wa","wi","we","wo", | |
"ga","gi","gu","ge","go", #"gya","gyu","gyo", | |
"za","ji","zu","ze","zo","ja","ju","jo", | |
"da","de","do", | |
"ba","bi","bu","be","bo", #"bya","byu","byo", | |
"pa","pi","pu","pe","po", #"pya","pyu","pyo", | |
] | |
def format_uid_digit (n): | |
if n != 0: | |
base = len(syllables) | |
s = format_uid_digit(n // base) | |
return s + syllables[(n % base)] | |
return "" | |
def format_uid (uid): | |
return format_uid_digit(uid) | |
import random | |
for i in range(100): | |
k = random.randrange((1 << 30)*4) | |
print hex(k), format_uid(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, what's the difference with the previous one? This is for base 65?