Generate 3 random number that sum to 1 in R

前端 未结 6 1167
花落未央
花落未央 2020-12-16 18:15

I am hoping to create 3 (non-negative) quasi-random numbers that sum to one, and repeat over and over.

Basically I am trying to partition something into three rand

6条回答
  •  无人及你
    2020-12-16 19:07

    just random 2 digits from (0, 1) and if assume its a and b then you got:

    rand1 = min(a, b)
    rand2 = abs(a - b)
    rand3 = 1 - max(a, b)
    

提交回复
热议问题