From owner-cvs-all Mon Feb 3 2:22:13 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D058E37B401; Mon, 3 Feb 2003 02:22:12 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7475743F43; Mon, 3 Feb 2003 02:22:12 -0800 (PST) (envelope-from ache@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h13AMCbv026203; Mon, 3 Feb 2003 02:22:12 -0800 (PST) (envelope-from ache@repoman.freebsd.org) Received: (from ache@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h13AMC8D026202; Mon, 3 Feb 2003 02:22:12 -0800 (PST) Message-Id: <200302031022.h13AMC8D026202@repoman.freebsd.org> From: "Andrey A. Chernov" Date: Mon, 3 Feb 2003 02:22:12 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/stdlib rand.c random.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ache 2003/02/03 02:22:12 PST Modified files: lib/libc/stdlib rand.c random.c Log: Park & Miller PRNG can be safely initialized with any value but 0 and stuck at 0 as designed. Its BSD adaptation tries to fight it by mapping 0 to 2147483647 after calculation, but this method not works since 2147483647 seed returns to 0 again on the next interation. Instead of after calculation mapping, map 0 to another value _before_ calculation, so it never stucks. Revision Changes Path 1.12 +4 -1 src/lib/libc/stdlib/rand.c 1.21 +4 -1 src/lib/libc/stdlib/random.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message