So far, this is final variant for 0 problem fixing ready for committing.
Any objections?
--- stdlib/rand.c.old Sat Jan 4 20:39:19 2003
+++ stdlib/rand.c Sun Feb 2 17:34:34 2003
@@ -72,10 +72,13 @@
*/
long hi, lo, x;
+ /* Can't be initialized with 0, so use another value. */
+ if (*ctx == 0)
+ *ctx = 123459876;
hi = *ctx / 127773;
lo = *ctx % 127773;
x = 16807 * lo - 2836 * hi;
- if (x <= 0)
+ if (x < 0)
x += 0x7fffffff;
return ((*ctx = x) % ((u_long)RAND_MAX + 1));
#endif /* !USE_WEAK_SEEDING */
--- stdlib/random.c.old Sun Mar 24 23:42:48 2002
+++ stdlib/random.c Sun Feb 2 17:09:19 2003
@@ -236,10 +236,13 @@
*/
long hi, lo;
+ /* Can't be initialized with 0, so use another value. */
+ if (x == 0)
+ x = 123459876;
hi = x / 127773;
lo = x % 127773;
x = 16807 * lo - 2836 * hi;
- if (x <= 0)
+ if (x < 0)
x += 0x7fffffff;
return (x);
#endif /* !USE_WEAK_SEEDING */
--
Andrey A. Chernov
http://ache.pp.ru/
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message