From owner-freebsd-hackers Sat Nov 28 20:01:42 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA18136 for freebsd-hackers-outgoing; Sat, 28 Nov 1998 20:01:42 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from furrball.dyn.ml.org ([207.18.137.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA18126 for ; Sat, 28 Nov 1998 20:01:38 -0800 (PST) (envelope-from chris@furrball.dyn.ml.org) Received: (from chris@localhost) by furrball.dyn.ml.org (8.9.1a/8.8.8) id VAA01271; Sat, 28 Nov 1998 21:58:27 -0600 (CST) (envelope-from chris) Date: Sat, 28 Nov 1998 21:58:27 -0600 (CST) From: Chris Costello Message-Id: <199811290358.VAA01271@furrball.dyn.ml.org> To: bf20761@binghamton.edu, freebsd-hackers@FreeBSD.ORG Subject: Re: random number and primitive polynomial Reply-To: phoenix@calldei.com In-Reply-To: X-Mailer: mail(1) -- the One True(TM) mail client Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > From chris Sat Nov 28 21:43:00 1998 > Date: Sat, 28 Nov 1998 22:21:56 -0500 (EST) > From: zhihuizhang > To: hackers > Subject: random number and primitive polynomial > > > Hi, I am now interested in how a truly random number is generated. The > source code is contained in file random_machdep.c. Can anyone tell me > where I can find good reference on how the primitive polynomial is related > to random number generation (i.e., its properties and role in a random > number generator). In /usr/src/lib/libc/stdlib/rand.c: int rand() { return ((next = next * 1103515245 + 12345) % ((u_long)RAND_MAX + 1)); } In /usr/include/stdlib.h: #define RAND_MAX 0x7fffffff > > By the way, I can not find where the file stdlib.h is located. According > to the manual, rand() are defined in it. I want to look at the source > code of rand() too (although it is said to be a bad random number > generator). /usr/include/stdlib.h It only declares the function in the .h file. Try looking around in /usr/src/lib/libc/stdlib for the stdlib function sources. (NOTE: You must have installed the source distribution to see this.) > > Any help is appreciated. > > -------------------------------------------------- > | Zhihui Zhang, http://cs.binghamton.edu/~zzhang | > | Dept. of Computer Science, SUNY at Binghamton | > -------------------------------------------------- > > -Chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message