mercredi 27 mai 2015

Good seed for Java random - Constructing a Maze

I am trying to make a program to construct a Maze (a classic exercise in Java) and I want to my method to generate the maze to recieve a seed for the aleatory number generator that is used to generate this. This is required because I want the program to generate the same maze everytime I enter the same seed. But, with some seed values, more values looks like to have more probability than others.

I mean, suppose that I set a random object with a given seed and use it to generate integers between [0, 4) and this is used as criteria to build the maze. The sequence generated is so characteristic that the maze is just too easy. Is I just dont set any seed, a good maze is generated. The integers part are just an example. I could use an uniform and divide it 4 regions: [0, 0,25), [0,25, 0.5), [0.5, 0.75), [0.75, 1)

Is there a way to modify that seed so that the behavior of the random number generator will be the same for the same seed and mantain the good "mixture" of the numbers? I mean, how can I generate the same numbers setting a seed such that they are evenly distributed in this intervals?

Thanks!




Aucun commentaire:

Enregistrer un commentaire