Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Chance of negative ID #38

@nixie

Description

@nixie

Hi,
I'm curious about the subtraction of 1 when generating new ID. Why is it here? The output of random.Random().getrandbits(k) is already in range [0,2^(k-1)], so subtracting 1 can result in new ID equal to -1 (even though with probability 1/2^64).

return guid_rng.getrandbits(64) - 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions