Is there a UNIX SVR2 random/srandom equivalent?

Edward C. Bennett edward at ukecc.UUCP
Mon Jul 15 06:21:04 AEST 1985


In article <156 at ukecc.UUCP>, edward at ukecc.UUCP (Edward C. Bennett) writes:
> In article <2399 at sun.uucp>, guy at sun.uucp (Guy Harris) writes:
> > > > Does anyone know what I should use in place of random and srandom?
> > > 
> 	In particular, while BSD and sysV RNGs both return ints, you
> must pay attention to what an int is. On a local VAX 11/750 an int is 4
> bytes. On our 3B20S an int is 2 bytes.
> 	Usually this won't make any difference, but every now and then
> you'll probably find a program where it does.

	It seems that I spoke too soon. Ints on our 3B20S are indeed 4 bytes
long. rand() returns a 4 byte value BUT (this is the catch) the value is
masked to its lower 15 bits yeilding 0 <= rand() <= 32767.

-- 
Edward C. Bennett

UUCP: ihnp4!cbosgd!ukma!ukecc!edward

/* A charter member of the Scooter bunch */



More information about the Comp.unix mailing list