Best Choice for Random Number Generator

There are so many randomizers. Some standard ones are dubiously slow. Some claim to be of high quality and speed. Some claim to be of higher quality. Some argue that they are even faster and better. Some claim speed but quality .

One of the facts that I know is that mwc-random is used by the Criterion comparison library, which speaks for itself, and applications are very promising.

Since for each generator there are at least two qualities: reliability and quality of the generated number - I will analyze the question of choosing the best generator in three categories:

  • The fastest
  • The one that generates the most random number
  • One who has the optimal combination of both of these qualities at an adequate speed

So what and why?

+4
source share
1 answer

I can only talk about mwc-random.

  • Fast ~ 15ns on Word32 on Phenom II. If you want to measure how fast this happens on your computer, it comes with a reference kit. However, you can trade for a period of speed. XORShift RNG should be faster, but have shorter periods of 2 ^ 32 or 2 ^ 64 instead of 2 ^ 8222.

  • Randomness

    . mwc-random uses the MWC256 algorithm (another name: MWC8222), which is not cryptographically secure, but works well in random tests. In particular, mwc-random passes an arbitrary shape randomness test .

+8
source

Source: https://habr.com/ru/post/1393418/


All Articles