Question: How many random values the follow codes will generate: rand(3), rand(1,3)? 7. Make a random function that returns an array of m pseudorandom Integers between
7. Make a random function that returns an array of m pseudorandom Integers between a low and high value specified. Again, as in exercise 3. type the function myRand in the Editor window. Use the rand function in your function, and call your solution myRand. Notice that myRand should have three parameters: the size of the array to return (m), the lowest integer value it should return, and the highest integer value it should return. Answer: From the help rand function (>> help rand), we can see how to use the rand function. For example, rand (1,8) returns 8 random values between 0 and 1 as an array. The numbers should range from low to high, so we multiply the values by high-low). Next, we add low to the results % Return a vector of m random values between low and high % % Usage: result-myRandlow, high. n) % function result myRandflow, high, n) result - round(rand(1.n)"(high-low)+low): Now we will test it out, with 100 random values. >>-myRand(10.90.100); >> plotx) myMin A) 2015 10 >> myMax(x) Ans Question How truny random values the follow codes will generate: rand(3) rand 1.3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
