This is an example class (without any actual purpose) of how to create a Random Map with X amount of different types of terrains (for example Mountains, Forests, Lakes -water-, etc).
The main difficulty is to generate all this elements in an array and still look "natural". Its not only to generate random map elements in the array, but to make them look like it's an actual terrain.
/Thanks to Arturo @Turin for helping me out with the JFrame part/
This code was using IntelliJ Community Edition (2016.2.2). You can download the full project from Github and run it in your computer. If you don't have IntelliJ, it should be enough to compile the package (com.daniloramirezcr) to run it. I will update soon the console command to compile and run in a terminal without any IDE.
The Main.java class has some variables that can modify the behavior of the application.
width = The width of the desire map
height = The height of the desire map
tolerance = The tolerance level of the map. The higher the number, the more times it will run all over the map to check inconsistencies and orphan MapElements.
I recomend testing with 100x100 for medium-end machines.
More information can be found in the Doc folder (Auto-generated by the IntelliJ Java Doc.
All the code belongs to Danilo Ramírez Mattey and covered with the Apache Licence 2.0. Please, if you are going to use this code give me some credit for it.