9 Apr
2020
9 Apr
'20
10:22 a.m.
Sorry: 65636 in the text should be 65536.
seed := (seed * 1309 + 13849) MOD 65536 (* use MOD 65636 to get the same output as C *) RETURN seed (* in V5 use MOD 65535 to prevent a crash in Tree *) END Rand;
In Oberon '... MOD 65536' produces the same pseudorandom numbers as '... & 65535' in C. I can understand that: at the bit level '... MOD 65536' is equivalent to '... & 65535'.
But could anyone explain why '... MOD 65636' gives a crash in Tree and '... MOD 65535' does not?