cvs commit: src/games/random random.c

John Baldwin jhb at FreeBSD.org
Thu Jun 23 17:14:28 GMT 2005


On Wednesday 22 June 2005 08:27 pm, Greg 'groggy' Lehey wrote:
> On Wednesday, 22 June 2005 at 15:24:00 +0000, John Baldwin wrote:
> > jhb         2005-06-22 15:24:00 UTC
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     games/random         random.c
> >   Log:
> >   Correct an error in the previous revision.  RAND_MAX is the maximum
> > value for rand(3), not random(3).  random(3) is defined to return values
> > between 0 and 2^31-1, so add a local RANDOM_MAX constant to this file
> > that is defined as 2^31-1 and use that in place of RAND_MAX.
>
> How much effect did this bug have on the results of random(3)?

This commit had zero effect as RAND_MAX is actually defined as 2^31-1, it is 
just a pedantic fixup of the previous revision (1.18) which changed random(6) 
from using LONG_MAX as the maximum value.  Using LONG_MAX mean that random(6) 
always selected zero lines from an input file on 64-bit archs such as amd64.  
The previous revision's log has an associated PR with more details.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the cvs-src mailing list