I see how to do that now.
sorry for late response I was away.
Post by Jason CiprianiPost by Dennis CoteI thought the important points were all hit upon: The behavior is
currently implementation defined. The new standard will change that
so that random_shuffle can use rand() by default. The Dinkumware
libs already use rand(). All the OP needs to do is call srand()
once to seed the generator so it doesn't always start with the same
sequence.
There is no need to use your own random number generator. Simply
ensure rand() is seeded with different values if you want different
random sequences.
Sure, but it's still important to point out that C++0x is not out
yet, it may be some more time after it's actually released before
runtime libraries conform, and even more time before developers are
actually using it (e.g. look at the BDS5 and 6 posts that are still
being made here). So while in the future that's fine, right now it's
not guaranteed all around.
And, while it *is* guaranteed with Dinkumware's implementation
(meaning that for the OP it should probably work just fine for his
particular situation), if he happens to be, say, writing a section
of code that is designed to be use outside of the context BCB (which
was unspecified), he may be surprised to find that srand() works
when he compiles it in BCB but not on another platform.
Currently, as the discussion covers, the standard does not require
rand(), and does not require srand() to affect random_shuffle.
Therefore, if one is going to have a detailed discussion about
standards, such as precise implementation details in C++0x, then one
should be consistent and also place the same amount of importance on
current standards. On the other hand it does make sense to do
whatever works with BCB; but the OP didn't specify enough
information (at least in public on this newsgroup) to indicate that
relying on BCB's specific behavior was safe.
So, no, it's not necessary to provide your own random number
generator if you are using BCB + Dinkumware or are going to wait
around for C++0x, but it's definitely important to point out the
consequences of making those assumptions.
Jason