>>x=rand(1,10);y=sum(x);r=x/y%r就是随机数和为一,且都是(0,1)内的数r=columns1through70.16230.02280.16360.11330.01750.04990.0980columns8through100.17160.17290.0282>>sum(r)ans=1.0000>>