5 ms·
He means that the constants are chosen so that the multiplication and addition can be done on a signed 32-bit integer without overflow.
by bonzini 4y ago
He means that the constants are chosen so that the multiplication and addition can be done on a signed 32-bit integer without overflow.
- morelisp 4y agoThere's no reason to avoid overflow (nor any reason to make it signed since that would also be a concern these days) though.
- bonzini 4y agoThat depends on the language. For example BASIC used to have only 16-bit or 32-bit signed integers (depending on the processor; plus strings and floating point), so this particular RNG can be useful for its portability.
- morelisp 4y agoSuch dialects of BASIC also offered defined overflow behavior (it's really only C/C++ and other things targeting MCUs that don't - and even three also only relatively recently that "undefined overflow" meant something more practically dangerous than "implementation defined") so it was still not a concern.
- a1369209993 4y ago> so that the multiplication and addition can be done on a signed 32-bit integer without overflow Except they can't: any seed in the range 230888 thru 233279 will produce a signed integer overflow when multiplied by 9301 (eg 9301*230888 = 0x80001608).
- bonzini 4y agoYou're right, that makes no sense. Also a-1 (9300) should not have factors in common with m (233280) but it has a lot...