Better random algorithm?

后端 未结 14 1789
情书的邮戳
情书的邮戳 2020-12-16 06:48

I\'m making a game in C++ and it involves filling tiles with random booleans (either yes or no) whether it is yes or no is decided by rand() % 1. It doesn\'t fe

14条回答
  •  一向
    一向 (楼主)
    2020-12-16 07:24

    Many pseudo-random number generators suffer from cyclical lower bits, especially linear congruential algorithms, which are typically the most common implementations. Some people suggest shifting out the least significant bits to solve this.

提交回复
热议问题