How to create randi function between 0-500

22 次查看(过去 30 天)
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?

回答(1 个)

Scott MacKenzie
Scott MacKenzie 2021-10-15
编辑:Scott MacKenzie 2021-10-15
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.

类别

Help CenterFile Exchange 中查找有关 Naming Conventions 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by