Re:Rent-a-coder hilarity (2008)
by rcfox on Monday May 06, 2013 @02:44AM
(#5661177)
Off the top of my head:
1) Assuming rand(x,y) gives a uniform distribution between x and y:
for (int a = 0; a < INT_MAX; a += rand(-1,1));
2) I can't find the source any more, but someone basically implemented a big int library with bit twiddling to allow for an upper bound on a loop that would finish after the heat-death of the universe, assuming generous CPU specs. Not infinite, but also non-terminating.
3) Anything that makes a system call. You might never get scheduled again!
Re:Rent-a-coder hilarity (2008)
by dagw on Monday May 06, 2013 @08:20AM
(#5661925)
As to 1) any rand() implementation that doesn't use an external source of randomness is deterministic and cyclical, thus it is quite possible to determine if 1) halts by analyzing rand()
1) Assuming rand(x,y) gives a uniform distribution between x and y:
2) I can't find the source any more, but someone basically implemented a big int library with bit twiddling to allow for an upper bound on a loop that would finish after the heat-death of the universe, assuming generous CPU specs. Not infinite, but also non-terminating.3) Anything that makes a system call. You might never get scheduled again!