DangerBlack / fantasy-city-planner

A tool for creating random city in a middle age fantasy world
GNU General Public License v3.0
3 stars 1 forks source link

Multiple runs using the same random number seed are not identical. #6

Closed hawson closed 8 years ago

hawson commented 9 years ago

They are similar, but the placement of most non-labeled buildings (and even some labeled ones) is random.

hawson commented 9 years ago

mappa_35 mappa_36 mappa_37

DangerBlack commented 9 years ago

I thinks it may depends on how python save list and dictionary, they can be ordered as they like it. I had a similar problem in android with java.

hawson commented 9 years ago

Makes sense. Lists are ordered, dictionaries aren't. Truly consistent results would be nice, but would probably mean refactoring a bunch of code. I suppose if the minor building placement (i.e. unlabeled random houses) happened at the very end, it won't matter much.

DangerBlack commented 9 years ago

Makes sense. Lists are ordered, dictionaries aren't. Truly consistent results would be nice, but would probably mean refactoring a bunch of code. I suppose if the minor building placement (i.e. unlabeled random houses) happened at the very end, it won't matter much.

We have to work on this issue but more tests are needed for discover why this happens.

test=[4,1,5,8]
end=list(test)
print(end)
#I had to test this...

no no no this is not the problem!!!

it's a race condition on random!!!!

Two different ran has two different scheduling! So buildings are moved randomly but each random happens in a different timeslice

DangerBlack commented 9 years ago

A possible solution is to sends N differents seed for each run, so each run is thread safe with his own random.