"Peter Ammon" <> wrote in message
news:bnpfl8$mqb$...
> I'm calling random_shuffle without passing in a RandomNumberGenerator
> and getting the same shuffle every time I restart my program. Apparently
> I need to seed the internal random number generator. But how? I can't
> find any way to do that, and if there is none, then how is the internal
> random number generator useful?
With difficulty.
The Standard provides no function to do this, and random_shuffle is forbidden
from using std::rand(). C++ "inherits" rand() from C (see [lib.c.math] -- rand
isn't defined in the C++ Standard at all, instead a reference is given to the
C Standard), and C states that "The implementation shall behave as if no
library function calls the rand function".
This constraint thus applies to C++, which thus prevents random_shuffle from
using rand().
A resolution is proposed.
http://anubis.dkuug.dk/jtc1/sc22/wg2...ctive.html#395
--
Now Playing: Marc Aurel - Running (dumonde remix) (D I G I T A L L Y - I M P
O R T E D - European Trance, Techno, Hi-NRG... we can't define it!)
char a[99999],*p=a;main(c,V)char**V;{char*v=c>0?1[V]:V;if(c)for(;(c=*v)&&93^
c;p+=!(62^c)-!(60^c),*p+=!(43^c)-!(45^c),44^c||read(0,p,1),46^c||putchar(*p)
,91^c||(v=*p?main(-1,v+1),v-1:main(0,v)),++v);else for(;c+=!(91^*v)-!(93^*v)
;++v);return v;} /*
brainf*** program as argv[1] */