"Roger Stafford" wrote in message <email@example.com>... > "Bruno Luong" <firstname.lastname@example.org> wrote in message <email@example.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(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.