Date: Wed, 3 Jul 2013 23:27:04 +0000 (UTC) From: "Andrey A. Chernov" <ache@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252648 - head/lib/libc/stdlib Message-ID: <201307032327.r63NR4OI060299@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ache Date: Wed Jul 3 23:27:04 2013 New Revision: 252648 URL: http://svnweb.freebsd.org/changeset/base/252648 Log: In addition to prev. commit, for repeated rand_r(3) calls don't forget to compensate back at the end incremented at the start internal state. MFC after: 2 weeks Modified: head/lib/libc/stdlib/rand.c Modified: head/lib/libc/stdlib/rand.c ============================================================================== --- head/lib/libc/stdlib/rand.c Wed Jul 3 23:24:53 2013 (r252647) +++ head/lib/libc/stdlib/rand.c Wed Jul 3 23:27:04 2013 (r252648) @@ -90,7 +90,11 @@ rand_r(unsigned int *ctx) #endif int r = do_rand(&val); - *ctx = (unsigned int) val; +#ifdef USE_WEAK_SEEDING + *ctx = (unsigned int)val; +#else + *ctx = (unsigned int)(val - 1); +#endif return (r); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307032327.r63NR4OI060299>