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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to