Generate random numbers uniformly over an entire range

后端 未结 17 2602
野性不改
野性不改 2020-11-22 04:21

I need to generate random numbers within a specified interval, [max;min].

Also, the random numbers should be uniformly distributed over the interval, not located to

17条回答
  •  醉梦人生
    2020-11-22 05:03

    By their nature, a small sample of random numbers doesn't have to be uniformly distributed. They're random, after all. I agree that if a random number generator is generating numbers that consistently appear to be grouped, then there is probably something wrong with it.

    But keep in mind that randomness isn't necessarily uniform.

    Edit: I added "small sample" to clarify.

提交回复
热议问题