From owner-freebsd-stable@FreeBSD.ORG Mon Apr 7 15:58:40 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7703437B407 for ; Mon, 7 Apr 2003 15:58:40 -0700 (PDT) Received: from obsecurity.dyndns.org (adsl-63-207-60-150.dsl.lsan03.pacbell.net [63.207.60.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E51743FB1 for ; Mon, 7 Apr 2003 15:58:39 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: from rot13.obsecurity.org (rot13.obsecurity.org [10.0.0.5]) by obsecurity.dyndns.org (Postfix) with ESMTP id 5DA9966D16; Mon, 7 Apr 2003 15:58:39 -0700 (PDT) Received: by rot13.obsecurity.org (Postfix, from userid 1000) id 415875B8; Mon, 7 Apr 2003 15:58:39 -0700 (PDT) Date: Mon, 7 Apr 2003 15:58:39 -0700 From: Kris Kennaway To: David Malone Message-ID: <20030407225839.GA60254@rot13.obsecurity.org> References: <200304070901.20557.timothy@voidnet.com> <20030407141603.GA96746@walton.maths.tcd.ie> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <20030407141603.GA96746@walton.maths.tcd.ie> User-Agent: Mutt/1.4i cc: freebsd-stable@freebsd.org Subject: Re: 4-stable and C rand()? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2003 22:58:41 -0000 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Apr 07, 2003 at 03:16:03PM +0100, David Malone wrote: > Rather than use rand()%32 you might want to use something like > (rand()+RAND_MAX/64)/(RAND_MAX/32) - using the high order bits means > that you are not effectively reducing the side of the state space. Or use a better PRNG like arc4random(). Kris --5vNYLRcllDrimb99 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+kgKfWry0BWjoQKURAtn5AJ9BjR6nM0/wS5oeusQwYTyLthDbzQCg4/DL B4Vk3bprs4axtMk6nwcHcGs= =7y8h -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--