‹ BackHN Continuity

Thread

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

288 points · 220 comments · BruceEel

  1. throwawayffffas · · focus · HN ↗
    So what? The point is to be non predictable not to pick all the numbers in the range with exactly the same probability. Would it be a problem if it never generated 16542?
    1. IAmBroom · · focus · HN ↗
      "Random" is used by most people to mean "random with an even distribution".

      A weighted die is still random, but with an uneven distribution. This is effectively a 2^16-sided, weighted die.

      1. throwawayffffas · · focus · HN ↗
        My argument to follow your analogy is.

        It's not a 2^16-sided weighted die. But a 2^16 - 1 sided fair die.

        I am not saying there is no bug. I am saying the bug has no practical impact.

        Sure if you are that one guy that is getting these values raw from the instruction and comparing to zero for some purpose then you are in trouble. But I am pretty sure no one is doing that, especially given that the bug surfaced after 6 years of millions of users.

        1. necovek · · focus · HN ↗
          I can imagine someone doing a

            pick = rnrand16() - 0x7fff
            if pick > 0...
          
          where these are not equally likely anymore (I may have an off-by-one anyway ;)).
          1. throwawayffffas · · focus · HN ↗
            Sure but by one part in 32k so it's not a big deal.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.