生产三个[0,1)的随机数相加为1
?
下面是一种容易想到的解法。生成是随机的,但分布不均匀。
不均匀解:
Double a=Math.random()
Double b=Math.random()*(1-a)
Double c=1-a-b