How to create randi function between 0-500
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have been asked to do a randi function between 0-500 with 50 organs.
I succed to made randi function with 500 max and with 50 organs, but how I should do it between 0-500? and not just 1-500?
0 comentarios
Respuestas (1)
Scott MacKenzie
el 15 de Oct. de 2021
Editada: Scott MacKenzie
el 15 de Oct. de 2021
Just use the imin-imax version of randi. For example
n = randi([0, 500], 50, 1);
generates a column vector of random integers in the range 0 to 500.
3 comentarios
Image Analyst
el 15 de Oct. de 2021
@Gil Tulian, please click the "Accept this answer" link to award Scott the Reputation Points he deserves for helping you. Thanks in advance. 🙂
Ver también
Categorías
Más información sobre Naming Conventions 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!