Skip to content

Instantly share code, notes, and snippets.

@paniq
Created November 19, 2018 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paniq/698e0ceaef7f07ef9ebacf1984e30abf to your computer and use it in GitHub Desktop.
Save paniq/698e0ceaef7f07ef9ebacf1984e30abf to your computer and use it in GitHub Desktop.
# 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)
@elect86
Copy link

elect86 commented Nov 27, 2018

Hi, what's the difference with the previous one? This is for base 65?

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