nrand48.c.patch   [plain text]


--- nrand48.c.orig	2009-11-07 14:51:38.000000000 -0800
+++ nrand48.c	2009-11-07 14:51:39.000000000 -0800
@@ -19,6 +19,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nra
 long
 nrand48(unsigned short xseed[3])
 {
-	_dorand48(xseed);
-	return ((long) xseed[2] << 15) + ((long) xseed[1] >> 1);
+	uint48 tmp;
+	DORAND48(tmp, xseed);
+	return (tmp >> 17) & 0x7fffffff;
 }