[mercury-users] random.m and integer overflow
Thomas Charles CONWAY
conway at cs.mu.OZ.AU
Fri Oct 16 11:07:00 AEST 1998
Martin Stein, you write:
> Hi,
>
> I've just investigated the random.m problem:
>
> The 3 constants A, C and M aren't appropriate for a 32 bit signed int! One needs
> a 32 bit unsigned int. A*M is arround 2^32. Using a seed a little less than M
> should give an integer overflow error. That's all.
> Properly A,C and M are a good choice, but not int.
>
Here are some values from Press et al (originally due to Knuth):
M A C
6075 106 1283
11979 430 2531
53125 171 11213
134456 141 28411
81000 421 17117
86436 1093 18257
120050 2311 25367
139968 3877 29573
Hope these are useful.
--
Thomas Conway <conway at cs.mu.oz.au>
Nail here [] for new monitor. )O+
More information about the users
mailing list