Re: [AD] rand() vs random()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2003-05-28, Hein Zelle <hein@xxxxxxxxxx> wrote:
> Eric Botcazou wrote:
> > > Allegro shouldn't be calling rand() at all, IMHO.  If the user starts
> > > using the blender, his output series from rand() will be mysteriously
> > > affected.  Luckily the number of people using the dissolve blender _and_
> > > expecting rand() to be unaffected is probably low.  I suppose we should
> > > just use our own private, dumb-but-fast generator for this case
> > > (something like what Paul Pridham posted).
> > 
> > Ok, we can try that. Should we make it public though, in light of the 
> > drawbacks of rand() on MacOS X and elsewhere?

I'm still against making it public, for more or less the same reasons I
gave in September last year.  (Plus another: it should be a crime to
knowingly distribute bad RNGs for general use.)

> First, I think as long as allegro only calls rand() and not srand(),
> users output shouldn't be affected: as long as you consistently call
> the blender functions the same amount of times, your random series
> should be reproducable.

But it's unexpected and very fragile.

-- 
王浩禎




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/