‹ BackHN Continuity

Thread

AMD's random number generator can't generate a 0?

288 points · 220 comments · BruceEel

  1. Rendello · · focus · HN ↗
    Another random boundary case: SQLite's RANDOM() won't generate the minimum i64 value, because:

        i64 MIN: −2⁶³
        i64 MAX:  2⁶³-1
    
    Since RANDOM() is used with ABS(), that floor value is lopped off. (Can you imagine if it weren't, and you got a bug 1 in every 2⁶⁴ calls?)

    <a href="https:&#x2F;&#x2F;sqlite.org&#x2F;lang_corefunc.html#random" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;lang_corefunc.html#random

    <a href="https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;4c0b09747a670652" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;4c0b09747a670652

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.