Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site twitch.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!twitch!grt From: grt@twitch.UUCP ( G.R.Tomasevich) Newsgroups: net.unix Subject: Precision of rand() Message-ID: <211@twitch.UUCP> Date: Fri, 19-Jul-85 18:02:46 EDT Article-I.D.: twitch.211 Posted: Fri Jul 19 18:02:46 1985 Date-Received: Sat, 20-Jul-85 12:29:46 EDT References: <1244@hound.UUCP> <11392@brl-tgr.ARPA> <2399@sun.uucp> <156@ukecc.UUCP> <157@ukecc.UUCP> Organization: AT&T Bell Labs, Holmdel Lines: 12 > 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 The length of the calculation has been 32 bits for a long time, even on the PDP-11. The static variable, randx, is a long. See the source routine, which is /usr/src/lib/libc/port/gen/rand.c on our machine. -- George Tomasevich, ihnp4!twitch!grt AT&T Bell Laboratories, Holmdel, NJ