can I generate random no. from 0 to 10E5, but the condition is ?
Show older comments
I want to generate random no. between 0 to 100E3 but the no. will be in increasing order
rand(1,5)
like this i want to generate but from 0 to 10E5 and 1-cross-80 elements.
Answers (1)
numbers = sort(100e3*rand(1,80),'ascend')
or
numbers(1) = 100e3*rand;
for i = 2:80
numbers(i) = numbers(i-1) + (100e3 - numbers(i-1))*rand;
end
numbers
depending on what you mean by "random" and "ascending".
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!