TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo.
from: John Beckett
date: 2004-12-07 08:44:30
subject: Re: c++ help

From: John Beckett 

On Mon, 6 Dec 2004 15:49:25 -0500, "Geo."  wrote:
> As I understand it, in an MFC app when OnPlay3 is called it's created, when
> it exits it's destroyed so wouldn't you need to initialize the random
> generator each time it's created?

I'm ignorant about MFC, but it doesn't sound likely that the code would
somehow be destroyed. Here is a test for you!

// This goes inside the OnPlay3 function.
static int count = 0;
++count;
// Do something to display the value of count.

At any rate, the rule is that each thread need to call srand. So, if MFC
does create a new thread each time (I doubt it), then yes you would need to
call srand each time. Otherwise, no.

John

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.