
Re: Generate random numbers with fixed sum and different constraints
Posted:
Nov 19, 2012 6:10 PM


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k8dakj$39u$1@newscl01ah.mathworks.com>... > It seems to me this task > w = randfixedsum(m,n,1,0,1) > can be optimized as well. .....          Yes, I agree, Bruno; 'randfixedsum' is rather cumbersome to use just for a single simplex. How about this instead:
R = bsxfun(@power,rand(m1,n),1./(m1:1:1)'); X = cumprod([ones(1,n);R]).*[ones(m,n)[R;zeros(1,n)]];
Roger Stafford

