random number generator test

后端 未结 4 1690
太阳男子
太阳男子 2021-01-03 00:42

How will you test if the random number generator is generating actual random numbers?

My Approach: Firstly build a hash of size M, where M is the prime number. Then

4条回答
  •  长情又很酷
    2021-01-03 01:28

    My naive idea:
    The generator is following a distribution. (At least it should.) Do a reasonable amount of runs then plot the values on a graph. Fit a regression curve on the points. If it correlates with the shape of the distribution you're good. (This is also possible in 1D with projections and histograms. And fully automatable with the correct tool, e.g. MatLab)
    You can also use the diehard tests as it was mentioned before, that is surely better but involves much less intuition, at least on your side.

提交回复
热议问题