Generate random numbers uniformly over an entire range

后端 未结 17 2312
野性不改
野性不改 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:10

    If you are able to, use Boost. I have had good luck with their random library.

    uniform_int should do what you want.

提交回复
热议问题