• io@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    3
    ·
    8 hours ago

    i was curious how unlikely exactly this would be.

    The randomUUID method generates a new version 4 UUID

    which is, According to the linked documentation, a 128bit number, with some “significant bits” being changed (no idea what that’s about, lets just say it’s a 128bit number)

    the chance of hitting a predfined number would be

    1/(2^128) or 1/340282366920938463463374607431768211456

    assuming your cpu does one comparison per Step at 4Ghz (4 billion per second) (idk how many steps it needs in reality, it doesn’t matter, more then one tho)

    that would take roughly

    2.696 x 10^21 years, which is

    2 x 10^11 or 200000000000 times the age of the universe

    (using the expected value of geometric distribution (1/p), so 1/(1/(2^ 128)) = 2^128 steps)