How do I use rand() to generate two vectors with n number of elements?

2 views (last 30 days)
How do I use rand() to generate two vectors with 10000 elements? Trying to make the elements in the vectors range between 0 and 100 uniformly.

Answers (1)

Mohammad Sami
Mohammad Sami on 1 Oct 2020
vector = rand(10000,1)*100;
% if you want integers
vector = randi(100,10000,1);

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!