Is Excel VBA's Rnd() really this bad?

前端 未结 5 943
情深已故
情深已故 2020-12-10 03:59

I need a pseudo random number generator for 2D Monte Carlo simulation that doesn\'t have the characteristic hyperplanes that you get with simple LCGs. I tested the random nu

5条回答
  •  囚心锁ツ
    2020-12-10 04:19

    As a balance between speed and goodness, I was thinking of combining them like

    for...
      z = [rand()] ' good but slow.
      for .. ' just a few
         t = z + rnd()
         t = t - int(t)
         ...
    

    Remember that good entropy + bad entropy = better entropy.

    That said, only 0.05ms per [rand()].

提交回复
热议问题