I am trying to create a "map" of random numbers, by only generating numbers within a certain area. The random numbers are used to create decimals which when high enough will create a star in the given location.
Ex:
for(int x = 1; x <= SCREEN_SIZE.width; x++){
for(int y = 1; y <= SCREEN_SIZE.height; y++){
if(star_map.getDouble(x + position[0], y + position[1]) <= (cvg)/100){
stars.add(new Star(x + position[0],y + position[0]));
}
}
}
I would like to be able to move the position around, so when it comes back to the same position, it should have the same stars.
I tried setting the seed of a Random based on the x, y, and general seed of the stars, but I kept getting either identical values, or nearly identical (All around 0.71).
Aucun commentaire:
Enregistrer un commentaire