random() error in Turbo C++

Evan Marshall Manning manning at coil.caltech.edu
Mon Sep 10 10:20:39 AEST 1990


henry at zoo.toronto.edu (Henry Spencer) writes:

>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...

Modern coding practice might suggest the use of comments in the source
code to prevent such accidents :-(

***************************************************************************
Your eyes are weary from staring at the CRT for so | Evan M. Manning
long.  You feel sleepy.  Notice how restful it is  |      is
to watch the cursor blink.  Close your eyes.  The  |manning at gap.cco.caltech.edu
opinions stated above are yours.  You cannot       | manning at mars.jpl.nasa.gov
imagine why you ever felt otherwise.               | gleeper at tybalt.caltech.edu



More information about the Comp.lang.c mailing list