Re: Seeding Random Numbers with Multiple Threads?
- From: "AliR \(VC++ MVP\)" <AliR@xxxxxxxxxxxxx>
- Date: Thu, 30 Nov 2006 15:28:18 -0600
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:that
For any process you should seed only once. What I am trying to say is
calleach thread should not seed, only the applications main thread should
constant.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
David Wilkinson
.
- References:
- Seeding Random Numbers with Multiple Threads?
- From: HumanJHawkins
- Re: Seeding Random Numbers with Multiple Threads?
- From: AliR \(VC++ MVP\)
- Re: Seeding Random Numbers with Multiple Threads?
- From: David Wilkinson
- Seeding Random Numbers with Multiple Threads?
- Prev by Date: Re: Memory problems (possibly very easy question)
- Next by Date: Re: user arrays and VARIANT *
- Previous by thread: Re: Seeding Random Numbers with Multiple Threads?
- Next by thread: Re: Seeding Random Numbers with Multiple Threads?
- Index(es):
Relevant Pages
|