How to generate a vector of random numbers whose total must be equal to 1?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
James Tursa
el 4 de Mzo. de 2020
See this FEX submission by Roger Stafford:
4 comentarios
James Tursa
el 4 de Mzo. de 2020
... sigh ...
Then transpose the result:
s = randfixedsum(3,1,1,0,1)';
Ver también
Categorías
Más información sobre Random Number Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!