269
you are viewing a single comment's thread
view the rest of the comments
[-] MangoCats@feddit.it 2 points 1 day ago

The question the optimizer can't really answer is: will Random.nextInt() ever return 10? If that's a 64 bit integer it could be a LOOOOOONG time before 10 ever shows up.

[-] ferric_carcinization@lemmy.ml 1 points 1 day ago

If it were a magic lang item, you could treat the resulting value in a special way. Then, you could create an optimization pass for this situation: if a variable is assigned random in a loop and the loop can only be exited with a certain value, the compiler can coerce the magic rand value to it.

[-] ryannathans@aussie.zone 1 points 1 day ago

Ah yes the halting problem

this post was submitted on 13 Dec 2025
269 points (97.9% liked)

Programmer Humor

39467 readers
17 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS