This commit is contained in:
Bryce
2026-02-21 07:55:11 -08:00
parent 8b50530081
commit f8c9495338
59 changed files with 1076 additions and 85 deletions

29
make_uid.py Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import secrets
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
def to_base36(num: int) -> str:
"""Convert integer to lowercase base36 (like Godot)."""
if num == 0:
return "0"
chars = []
while num:
num, rem = divmod(num, 36)
chars.append(ALPHABET[rem])
return "".join(reversed(chars))
def generate_godot_uid() -> str:
# Generate a random 64-bit unsigned integer
value = secrets.randbits(64)
# Encode to base36
encoded = to_base36(value)
return encoded
if __name__ == "__main__":
print(generate_godot_uid())