bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Implementations of random, srandom, initstate, setstate, ran


From: Richard W.M. Jones
Subject: Re: [PATCH] Implementations of random, srandom, initstate, setstate, rand, srand
Date: Thu, 6 Nov 2008 15:40:06 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Nov 04, 2008 at 03:26:55AM +0100, Bruno Haible wrote:
> Hi,

Hi - sorry, I went on holiday just after you posted this, hence the
late response ...

> Richard W.M. Jones wrote:
> > This patch adds a 'random' module which implements:
> > 
> >   - random
> >   - srandom
> >   - initstate
> >   - setstate
> 
> This is welcome!
> 
> > and replaces:
> > 
> >   - rand
> >   - srand
> >   - RAND_MAX
> 
> It shouldn't do that. The random/srandom/initstate/setstate and
> rand/srand/RAND_MAX facilities are unrelated. See
>   <http://www.opengroup.org/susv3/functions/random.html>
>   <http://www.opengroup.org/susv3/functions/rand.html>

Interesting ...  Good that random doesn't use RAND_MAX.  It seems to
indicate a bug of sorts in glibc (or at least, in the man pages)
though.

[...]
> If you want to provide an override for the rand() function, it should IMO
>   1. not be automatically enabled by the 'random' or 'random_r' modules,
>   2. explain in the doc what you mean by not "high quality" of some
>      implementations (a period less than 2^32? lower bits that are easy to
>      guess?), and which implementations are affected.

My take from this is we need separate modules, rand and random, is
that right?

The existing random_r module is folded into random.

'rand' is a new module which is advisory for those platforms that
believe they may have a losing rand() implementation, eg. ancient
versions of Solaris.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]