Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix Subject: Re: Is there a UNIX SVR2 random/srandom equivalent? Message-ID: <2419@sun.uucp> Date: Tue, 16-Jul-85 04:00:26 EDT Article-I.D.: sun.2419 Posted: Tue Jul 16 04:00:26 1985 Date-Received: Thu, 18-Jul-85 05:55:54 EDT References: <1244@hound.UUCP> <11392@brl-tgr.ARPA> <2399@sun.uucp> <156@ukecc.UUCP> Organization: Sun Microsystems, Inc. Lines: 22 > 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. Geepers, that flies in the face of whatever I've heard about the 3B20. (BTW, I think the changes of the size of an "int" being different on other VAXes, even if they're different models, are somewhere between zip, zero, and nil.) What I think you mean to say is In particular, while 4.xBSD and (PDP-11 V7/System III/System V) RNGs both return "int"s, you must pay attention to what subrange of the range of an "int" they return. On 4.xBSD they return a number in the range 0 - 2^31 - 1. On Systems III and V, and on V7 implementations on 16-bit machines, they return a number in the range 0 - 2^15 - 1. (On UNIX/32V it returns a number in the range 0 - 2^31 - 1, which is presumably why 4.xBSD does so also. I presume they decided to make it return the same range on 16-bit-"int" and 32-bit-"int" machines in System III - or UNIX/TS - to make it possible to reduce the result of "rand" to a fixed range without #ifdefing code for different "int" sizes.) Guy Harris