Re: Seeding Random Numbers with Multiple Threads?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



David you are right. I am trying to think why I thought that. I remember
having a problem with random numbers and I think the problem was due to the
fact that I was calling srand in each thread.

But anyway, you are right. :)
AliR.

"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message
news:O1fVXRMFHHA.4768@xxxxxxxxxxxxxxxxxxxxxxx
AliR (VC++ MVP) wrote:

For any process you should seed only once. What I am trying to say is
that
each thread should not seed, only the applications main thread should
call
srand. All calls to rand will be based on the same seed no matter which
thread they are running in.

AliR;

I don't think so. The standard rand(), at least, is seeded separately in
each thread.

To the OP: What about just using

n
n + c
n + 2c
n + 3c

where n is derived from the time, and c is some "suitable" integer
constant.

David Wilkinson


.



Relevant Pages

  • Re: How to _Spell_ Chromatic Scales
    ... that I said "screw you already David". ... > Your post should have illustrated the standard chromatic scale in the ... > that's standard or not. ... _did_ get it right the first time around, ...
    (alt.guitar.beginner)
  • Re: Harry Haters!
    ... dmclallen@xxxxxxxxx (David) wrote; ... > Hildr Katze wrote: ... >LOL! ... The standard is that these people don't ...
    (alt.fan.harry-potter)
  • Re: Godel proved maths inconsistent not incompleteness theorem
    ... sentences coincide with the unrefutable ones, ... Why not just say Rosser's theorem itself is "standard"? ... can give an even shorter proof. ... David C. Ullrich- Hide quoted text - ...
    (sci.logic)
  • Re: JS-History 1:19
    ... >>definitions on Mormonism are, in a word, silly. ... > Well, David, this is a public newsgroup in standard English ...
    (soc.religion.mormon)
  • Re: JS-History 1:19
    ... > definitions on Mormonism are, in a word, silly. ... Well, David, this is a public newsgroup in standard English ... the "standard public English ...
    (soc.religion.mormon)