开发者

Do all the numbers have equal probability to be returned on every Random.Next() call?

Is the probability of Random.Next() to return x the next time it's called low开发者_开发百科er than its probability of returning y if it has just returned x?


No, if for example the number 5 is returned from your random call, the probability that 5 is chosen again is the same as any number within your range.

It helps somewhat to understand that random distribution is different from regular distribution. Random distribution tends to create clusters of similar data, and is often not as regular as you might expect.


It's supposed to generate i.i.d. numbers, which stands for independent, identically distributed.

Independent means that the next number doesn't depend on the history in any way.

Of course, since it's a PRNG and not truly random, they won't be perfectly independent, but I doubt you can tell the difference.


Random.Next doesn't generate random numbers. It's next sample is known deterministically from its state.

For a true random number generator, that was producing iid samples, then there previous value would of course have no bearing on the next value. That's the independent part of iid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜