Better random algorithm?

后端 未结 14 1832
情书的邮戳
情书的邮戳 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:41

    With random numbers to get good results you really need to have a generator that combines several generators's results. Just discarding the bottom bit is a pretty silly answer.

    multiply with carry is simple to implement and has good results on its own and if you have several of them and combine the results you will get extremely good results. It also doesn't require much memory and is very fast.

提交回复
热议问题