Summation of Random Numbers

1 view (last 30 days)
How would you go about writing a code to solve a summations of randomly generated intergers, say r= to an equation, until the sum is greater than a number, say x.

Accepted Answer

Walter Roberson
Walter Roberson on 13 Oct 2019
I would use a while loop.
while summation <= x
%add a random integer to the summation
end

More Answers (0)

Categories

Find more on Mathematics 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!