View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004572 | Spring engine | General | public | 2014-10-05 12:55 | 2016-11-05 21:46 | ||||
Reporter | silentwings | ||||||||
Assigned To | hokomoko | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 97.0.1+git | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0004572: random number generator is not random in pregame | ||||||||
Description | In 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 Reproduce | see attached gadget I am not sure how to provide more info; let me know if/what more is useful. | ||||||||
Additional Information | I am not seeding the synced random number generator (in 96.0 there was no need too). Am I supposed too? If so, with what? | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
Notes | |
abma (administrator) 2014-10-05 17:40 |
this works: function gadget:GameStart() for i=1,10 do Spring.Echo(math.random(1,10)) end end 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) 2014-10-05 17:57 |
is this still a major "bug" then? |
silentwings (reporter) 2014-10-05 18:22 |
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) 2014-10-28 02:32 |
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) 2016-11-05 21:46 |
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 |