MATLAB Answers


Random Vectors with Fixed Sum (algorithm of Roger Stafford)

Asked by Wim
on 21 Mar 2014
Latest activity Answered by Jos (10584)
on 21 Mar 2014

Dear Matlab users,

on, a function is provided by Roger Stafford to randomly and uniformly generate vectors with a specified sum and values in a specified interval.

I would like to use this function in paper, and wonder whether the proposed algorithm/function has previously been described/documented in the literature, so that I can properly cite it. (I tried to directly contact Roger Stafford, but the provided email address no longer exists)

Thank you very much in advance for your response,

Kind Regards, Wim



No tags are associated with this question.


No products are associated with this question.

1 Answer

Answer by Jos (10584)
on 21 Mar 2014

I would cite the function as a website. Something like this suffices, I think:

R. Stafford (2006). RandfixedSum, Matlab File Exchange #9700,


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!