2024-05-16 06:23 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002225Spring engineGeneralpublic2010-11-20 22:20
ReporterSirMaverick 
Assigned ToKloot 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.82.6.1 
Target VersionFixed in Version0.82.7 
Summary0002225: CGlobalUnsynced random seed not really random
DescriptionCGlobalUnsynced is seeded by SDL_GetTicks. SDL_GetTicks() is number of milliseconds since SDL library initialization. In SpringApp::Initialize() CGlobalUnsynced is created 3 lines after call to InitWindow which initializes SDL. Chances are that, on a fast CPU, this is done in under a millisecond - you will seed with 0.

This seed is later used in GameData which is broadcasted by GameServer to seed CGlobalSynced's random function. So you'll have (with high probability) the same random number sequence in each run.

Using a more random source might be useful. E.g. time?
Additional Informationhttp://springrts.com/phpbb/viewtopic.php?f=23&t=24563
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0005887

Kloot (developer)

done
+Notes

-Issue History
Date Modified Username Field Change
2010-11-20 13:49 SirMaverick New Issue
2010-11-20 22:20 Kloot Note Added: 0005887
2010-11-20 22:20 Kloot Status new => resolved
2010-11-20 22:20 Kloot Fixed in Version => 0.82.6.1+git
2010-11-20 22:20 Kloot Resolution open => fixed
2010-11-20 22:20 Kloot Assigned To => Kloot
+Issue History