bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] random_r: new module


From: Richard W.M. Jones
Subject: Re: [PATCH] random_r: new module
Date: Thu, 23 Oct 2008 15:11:15 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Oct 22, 2008 at 10:06:28PM +0200, Jim Meyering wrote:
> I saw that there was no random-number generating module in gnulib,
> and certainly nothing reentrant, so took glibc's random_r.c and did this:

I need random() and drand48() to port some Unix program to Windows.
Win32 doesn't have either of these functions.

I know that these reentrant versions are better, but they are
glibc-only and very recently added to glibc at that.  Shouldn't we
also provide standard versions (random, rand, drand48, srandom, srand)
for people who lack them?

I was going to produce a full-blown patch for this, and will do if you
can supply me with the latest version of your patch.  However the
additional functions are in glibc and quite simple, eg, random is
essentially just this (with glibc-isms removed):

  long int
  random ()
  {
    int32_t retval;
    (void) random_r (&unsafe_state, &retval);
    return retval;
  }

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]