How to test a random generator

2019-02-01 18:42发布

I need to test a random number generator which produces numbers randomly. How to make sure the numbers generated are random.

13条回答
看我几分像从前
2楼-- · 2019-02-01 19:39

Use chi-square testing. What language are you using? I can offer a C++ example. Basically

  • Place random numbers in buckets (many times).
  • The number of buckets minus one is the degrees of freedom.
  • Compare the bucket tallies against "expected" tallies, yielding a chi-square result.
  • Use a chi-square calculator to see the probability of getting those results.
查看更多
登录 后发表回答