- #1
SteliosVas
- 70
- 0
Homework Statement
The number of iterations it takes for the product of two random numbers to produce a number less than 1e-5.
Homework Equations
The Attempt at a Solution
while z < 1e-05count1 = count + 1;
x = rand(1,1); %rand 1x1 matrix
z = floor(a + (b-a+1) * rand(b,1));
if z < 1e-05
break
end
endNow I keep getting an error saying:
Error using rand
Size inputs must be scalar.
Why is this?EDIT:
while 2
% randomIntegers < 1e-05
count1 = count1 +1;
randomIntegers = randi([-10,10],[20,1]);
if randomIntergars > 1e-05
break
end
end
I tried this and it's still not working
Last edited: