[Oberon] ... MOD 65536
Hans Klaver
hklaver at dds.nl
Thu Apr 9 10:22:26 CEST 2020
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?
More information about the Oberon
mailing list