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

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


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?

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.

Second, I think for the public we should start with alrand, and merge
it with allegro if necessary. Writing a dumb generator just for the
blender seems like a waste when you also want to provide a portable
random function to allegro users. Then again, the random generator
seems to be only a small bit of code, so it's not a big deal.

Hein Zelle

>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-< 
 Unix is user friendly. It's just very particular about who 
 it's friends are.

 Hein Zelle                     hein@xxxxxxxxxx
	                        http://www.icce.rug.nl/~hein
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<




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