Is code that terminates on a random condition guaranteed to terminate?
- by Simon Campbell
If I had a code which terminated based on if a random number generator returned a result (as follows), would it be 100% certain that the code would terminate if it was allowed to run forever.
while (random(MAX_NUMBER) != 0): // random returns a random number between 0 and MAX_NUMBER
print('Hello World')
I am also interested in any…