Heyo! I'm making a 2d sandbox game(like terraria). Everything is working fine. So far it can generate a random terrain and trees. I have come across an issue though.
I use Java's Random class to generate a random number which I use to determine wether or not to create a tree. Here's the issue: Trees seem to be clustered all together. I get large areas with no trees and then large areas that are packed with trees. I think this is happening because Java's Random class is not random enough.
Are there any other classes included with the JDK or any external libraries I can install that can generate TRULY random numbers? Thanks in advance :D
---EDIT---- Here is how I generate the number.
Random rand = new Random();
rand.setSeed(worldGenerator.getSeed());
int randomNumber = rand.nextInt(1000) + 1;
Aucun commentaire:
Enregistrer un commentaire