TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: John Beckett
from: Geo
date: 2004-12-06 18:22:02
subject: Re: c++ help

From: "Geo" 

Ok, the static is remembered but is an srand() remembered? I guess I could
just try it and if I don't get random numbers then it's not remembered.

Geo.

"John Beckett"  wrote in
message news:ibk9r0l8bege0qo4v4gsg6b6idvijthcjj{at}4ax.com...
> 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™.