Pergunta

Say I have a simple program that has the pseudocode like this:

min = 1
max = 100
c = 5
random = randomInt(min,max)
while(c != random):
    random = randomInt(min,max);

Theoretically, from what I understand, I cannot guarantee this will halt. However, is this true for both PRNGs and say, random integers generated using atmospheric noise? Is there a difference? And by convention, can I say this will "almost surely" halt (probability 1), but still cannot guarantee this? I'm still trying to wrap my mind around the edge case of a program with an almost sure chance of halting, and how this is viewed from a computational perspective.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top