Fix lrand48() and rand()
authorH. Peter Anvin <hpa@zytor.com>
Mon, 11 Aug 2008 16:14:40 +0000 (09:14 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 11 Aug 2008 16:14:40 +0000 (09:14 -0700)
lrand48() and rand() had improper parenthesization, which caused it to
return negative values.

Spotted by Stefan Bucur :)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/lib/lrand48.c

index f26d099..03ad377 100644 (file)
@@ -37,5 +37,5 @@ long nrand48(unsigned short xsubi[3])
 
 long lrand48(void)
 {
-  return (long)((uint32_t)(mrand48() >> 1));
+  return (long)((uint32_t)mrand48() >> 1);
 }