"Roger Stafford" wrote in message <firstname.lastname@example.org>... > "Bruno Luong" <email@example.com> wrote in message <firstname.lastname@example.org>... > > 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(m-1,n),1./(m-1:-1:1)'); > X = cumprod([ones(1,n);R]).*[ones(m,n)-[R;zeros(1,n)]]; > > Roger Stafford
Really cool Roger! I would love if you could share the justification of this formula.