Date: Mon, 3 Feb 2003 02:22:12 -0800 (PST) From: "Andrey A. Chernov" <ache@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/stdlib rand.c random.c Message-ID: <200302031022.h13AMC8D026202@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302031022.h13AMC8D026202>