Re: [BUG] fill_random_bytes broken

From: Shawn Lewis <shawnlewis_at_google.com>
Date: Thu, 26 Jul 2007 11:36:56 -0700

On 7/26/07, Jens Axboe <jens.axboe_at_oracle.com> wrote:
>
> On Thu, Jul 26 2007, Jens Axboe wrote:
> > On Wed, Jul 25 2007, Shawn Lewis wrote:
> > > verify.c: fill_random_bytes() doesn't work as intended.
> > >
> > > drand48 on linux returns a double whose value is evenly distributed
> between
> > > 0.0 and 0.1. This is not the same as having an 8-byte value where each
> bit
> > > has the same chance of being 0 as it does of being 1.
> > >
> > > I'd fix this but it should probably be done in a cross-platformish way
> and
> > > I'm not quite sure how to do it. Maybe just use smaller randoms? Have
> an
> > > os_random_uint32?
> >
> > Hmm indeed, that looks problematic. If you have a suggested fix, fire
> > away :-)
>
> OK, I just got rid of os_random_double() and used os_random_long() for
> the verify stuff. It looks like it's working fine, can you confirm?

Hmm, almost ok. But os/os-linux.h is broken also. lrand48 returns a
non-negative long, so the high bit is never touched. How about using
mrand48, patch upcoming :)

--
> Jens Axboe
>
>
Received on Thu Jul 26 2007 - 20:36:56 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 26 2007 - 21:00:02 CEST