#!/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())
