How to generate a vector of random numbers whose total must be equal to 1?
2 views (last 30 days)
Show older comments
I want to generate a random vector. if i add all the values in the generated vector, its sum should be equal to 1.
0 Comments
Answers (1)
James Tursa
on 4 Mar 2020
See this FEX submission by Roger Stafford:
4 Comments
James Tursa
on 4 Mar 2020
... sigh ...
Then transpose the result:
s = randfixedsum(3,1,1,0,1)';
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!