Implementing Box-Mueller random number generator in C#

前端 未结 5 543
谎友^
谎友^ 2020-12-14 23:15

From this question: Random number generator which gravitates numbers to any given number in range? I did some research since I\'ve come across such a random number generator

5条回答
  •  盖世英雄少女心
    2020-12-15 00:05

    I am no mathematician, or statistician, but if I think about this I would not expect a Gaussian distribution to return numbers in an exact range. Given your implementation the mean is 0 and the standard deviation is 1 so I would expect values distributed on the bell curve with 0 at the center and then reducing as the numbers deviate from 0 on either side. So the sequence would definitely cover both +/- numbers.

    Then since it is statistical, why would it be hard limited to -1..1 just because the std.dev is 1? There can statistically be some play on either side and still fulfill the statistical requirement.

提交回复
热议问题