[comp.sys.hp] RAND_MAX in stdlib.h is wrong

tt@euler.jyu.fi (Tapani Tarvainen) (10/14/90)

Just a quick note in case anybody should happen to use code like

$include <stdlib.h>
...
	(double)rand()/RAND_MAX

the definition of RAND_MAX in stdlib.h is wrong:

#  define RAND_MAX 32763

whereas it should be 32767.  (This is in HP-UX 7.0; earlier releases
didn't have RAND_MAX defined at all, newer ones I don't know about.)
--
Tapani Tarvainen    (tarvaine@jyu.fi, tarvainen@finjyu.bitnet)

rodean@hpfcdc.HP.COM (Bruce Rodean) (10/16/90)

In article <TT.90Oct14171739@euler.jyu.fi> tt@euler.jyu.fi (Tapani Tarvainen) writes:
> Just a quick note in case anybody should happen to use code like
> 
> $include <stdlib.h>
> ...
> 	(double)rand()/RAND_MAX
> 
> the definition of RAND_MAX in stdlib.h is wrong:
> 
> #  define RAND_MAX 32763
> 
> whereas it should be 32767.  (This is in HP-UX 7.0; earlier releases
> didn't have RAND_MAX defined at all, newer ones I don't know about.)

It appears that this was just a typographical mistake made the first
time it was created.  It has already been corrected for the next
revision of HP-UX to 32767 as you stated.  Thanks for pointing it out.

Bruce Rodean
Hewlett-Packard Co.
rodean@hpfcla.HP.COM

This does not represent the official position of Hewlett-Packard Co.