How to specify , n ,the number of random integers
Show older comments
Write a Matlab function r = random(x,y) which takes as input two integers x and y, and generates and returns a random integer that is equally likely to take any value between x and y?
Then, write a program use random() to generate 100,000 random numbers between 1 and 10. Store each random number in an vector.
Heres what I got so far:
function r = random(x,y) r = floor(x + y.*rand(n,1)) ??? end
program: n = 100000; x = 1; y = 10; r = random(x,y);
Accepted Answer
More Answers (0)
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!