random() error in Turbo C++
Henry Spencer
henry at zoo.toronto.edu
Mon Sep 10 08:45:36 AEST 1990
In article <DAVEG.90Sep9012053 at near.cs.caltech.edu> daveg at near.cs.caltech.edu (Dave Gillespie) writes:
>Sometimes rand() will tweak its results to be less blatantly bad
>in the low bits, but every one I've seen was ultimately linear
>congruential.
The original Unix rand() did a 32-bit calculation internally and returned
the HIGH-order 16 bits. Unfortunately, certain idiots porting the system
to 32-bit machines wanted a 32-bit rand() and didn't bother understanding
why it was done the way it was...
--
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday| henry at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list