I need some clarification regarding if computer scientists say a program like:
$random_value = Get-Random -Maximum 100
Write-Output $random_value
while ($random_value -ne 0) {
$random_value = Get-Random -Maximum 100
Write-Output $random_value
}
always halts. It's PowerShell code that runs Get-Random a pseudo-random number of times, basically until Get-Random returns 0. I'm interested in this class of programs, not just this concrete example.
I truly see some ambiguity about whether we can say these types of programs always halt. If they don't always halt (because maybe one execution is so lucky to never land on 0), then this seems to make the Halting Problem incredibly basic, almost too basic (not that that's necessarily a bad thing). Like, of course the Halting Problem must be true based off this example, just show this in every intro CS class (then why didn't my professor?). If they do always halt (because let's face it, this program will halt in some finite time based on probability), then I guess I need to get used to this lingo that computer scientists seem to make more natural sense of than I do.
To me, taker of a single CS class so far, we would need to run it to see if it halts, and that's the only way. No other program could tell. Because technically it could run forever if the hardware didn't fail.
Maybe the pseudo-random nature of Get-Random makes this always halt in a more clear cut manner. Then I'll just have to ask about non-pseudo-random random() functions.