| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | c++ help |
G> From: "Geo"
G> "John Beckett" wrote in
G> message news:41b2a4bc.23977267{at}216.144.1.254...
>> for (int i=1; i<=rand(); i++) { /* do something */ }
>>
>> I guess it doesn't matter, but this loop will call rand
>> every time the loop is entered. This does nothing helpful.
G> It's a way of randomizing it because if you run the function
G> twice quickly the time function doesn't provide very good seed
G> values. The idea was to use the rand() function more to
G> generate a better random value. IE, I want rand() called
G> multiple times.
FWIW: this likely doesn't really return as random a seed as you'd like...
back when i was doing a lot more coding than i do these days, there was a
lot of discussion on setting the random seed several times to achieve
"more random" sequences... many tests and a lot of mathematical
analysis showed that what actually happened was more predictability rather
than more randomness...
i can't really add much more than that...
)\/(ark
* Origin: (1:3634/12)SEEN-BY: 633/267 270 5030/786 @PATH: 3634/12 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™.