2019-12-07 07:38 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004572Spring engineGeneralpublic2016-11-05 21:46
Assigned Tohokomoko 
Product Version97.0.1+git 
Target VersionFixed in Version 
Summary0004572: random number generator is not random in pregame
DescriptionIn 97.0.1-458 I get the same sequence of random numbers (in synced luarules) each time I start Spring.

The only thing I've found which changes the sequence of "random" numbers produced is changing the map - changing the number of players and various other things did not.

In 96.0 I get a different sequence of random numbers, even if I don't change anything. (I have a randomized spawning gadget which depends on this behaviour.)
Steps To Reproducesee attached gadget

I am not sure how to provide more info; let me know if/what more is useful.
Additional InformationI am not seeding the synced random number generator (in 96.0 there was no need too). Am I supposed too? If so, with what?
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files




abma (administrator)

this works:

function gadget:GameStart()
for i=1,10 do

since a while the pathcache is created after lua is initialized, i guess this is why there is no randomness before pathcache is created, else the pathcache would be invalid!?

not sure if this can be fixed in a clean way to have real random numbers before path cache is created.


abma (administrator)

is this still a major "bug" then?


silentwings (reporter)

Yes, you are right, it seems that (synced) gadget:GameStart() produces randomness but gadget:Initialize() does not.

This is enough for my current purpose, so I'll leave it to you to judge if its safe to release without finding the cause of this - I don't know enough to judge if there is a desync risk hiding somewhere here.


silentwings (reporter)

It seems LuaIntro does not have randomness either (even though the random number generator is seeded with os.clock() in /luaintro/config.lua).

In 98.0, the loadscreen shown is always the same (e.g. BA 8.06).


hokomoko (developer)

Fixed AFAIK - LuaIntro screens are random

-Issue History
Date Modified Username Field Change
2014-10-05 12:55 silentwings New Issue
2014-10-05 12:55 silentwings File Added: testbed.lua
2014-10-05 13:11 abma Target Version => 98.0
2014-10-05 17:40 abma Note Added: 0013705
2014-10-05 17:57 abma Summary random number generator is not random => random number generator is not random in pregame
2014-10-05 17:57 abma Note Added: 0013706
2014-10-05 17:57 abma Status new => feedback
2014-10-05 18:22 silentwings Note Added: 0013707
2014-10-05 18:22 silentwings Status feedback => new
2014-10-05 18:37 abma Target Version 98.0 =>
2014-10-07 18:51 abma Severity major => minor
2014-10-28 02:32 silentwings Note Added: 0013778
2016-11-05 21:46 hokomoko Assigned To => hokomoko
2016-11-05 21:46 hokomoko Status new => resolved
2016-11-05 21:46 hokomoko Resolution open => fixed
2016-11-05 21:46 hokomoko Note Added: 0016856
+Issue History