This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fear and loathing in SGI's random-number generator



Levente Farkas <lfarkas@mindmaker.hu>:
> Phil Edwards wrote:
> > Anybody have any thoughts as to alleviate this?  Maybe provide some
> > seed_random() wrapper around the seeders that performs the same conditional
> > compilation?  Surely somebody has used random_shuffle before and solved
> > this already?  What do they use at SGI?
>
> IMHO those who realy need "random" random use thier own random generator

Of course.  But it needs to not be surprising for people who just want
simple pseudorandom behavior.


> or know about
> srand48 (look into the code) those who just need "some" random generator
> the deafult may be good.

But the default (srand) has no effect when the newer RNG is used.  We can't
expect casual users to dig down into the headers far enough to figure out
what's going on.  It took me almost five minutes, and I know the headers
pretty well -- somebody who doesn't know the guts of libstdc++-vN wouldn't
even know where to begin to look in the code.  And shouldn't have to.

Perhaps I'm making too much of this.


> anyway I think it'd be good to put srand48 into namespace std as srand
> on platform which support it and those who realy use c++ eg. <cstdlib>
> find that srand and don't have to care about it.

We don't supply srand nor srand48... and I don't think we should silently
rename one to be the other.  If the system C library desginers want to make
their default RNG be the 48-bit one, that's excellent, but out of our hands.


Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]