Generate N random numbers within a range with a constant sum

前端 未结 5 886
暗喜
暗喜 2020-12-03 12:26

I want to generate N random numbers drawn from a specif distribution (e.g uniform random) between [a,b] which sum to a constant C. I have tried a couple of solutions I could

5条回答
  •  醉话见心
    2020-12-03 12:55

    well, for n=10000 cant we have a small number in there that is not random?

    maybe generating sequence till sum > C-max reached and then just put one simple number to sum it up.

    1 in 10000 is more like a very small noise in the system.

提交回复
热议问题