This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Map-related deja-vu


On Thu, 30 Sep 2004, Lincoln Peters wrote:
> Since the world-size is set to 240x120 (circumference 1440), I would
> think that the chance of getting the exact same map twice would be
> astronomically low.  Has anyone else experienced this kind of behavior? 

As far as I can tell, XConq's random number generator, if not seeded from
the command line with the -R option, automatically seeds itself with the
system time modulo 100000.  By the Birthday Paradox, you should expect to
see a collision (i.e. two games starting with the same seed) if you play
316 games.  (= sqrt(100000))  I think it's plausible that in heavy testing
you might start that many games.  The world-size isn't relevant because
the generator only gets seeded once - so you aren't choosing maps from the
space of all possible maps (which space gets bigger with bigger
maps).  There are 100000 maps that can ever be generated, and you get one
of those more or less at random.

Is this a problem?  If so, we could easily put in a better seeding rule
and/or a better random number generator.
-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                    Embrace and defend.
http://ansuz.sooke.bc.ca/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]