It is not so easy.
Two main approach is to use or a noise-based techniques or if you are more advanced - polygonal techniques.
I suggest you to start with googleing about "Perlin noise"
this noises good for map generating.
You can can reed some useful stuff here:
http://www.redblobgames.com/articles/no ... ction.html
http://www-cs-students.stanford.edu/~am ... eneration/
One way (and probably the most easy way) to implement it:
*Create two dimensional array the size of your map (lets say 2000 horizontally by 1000 vertically),
*Assign there random values (lets say from -10 to 20).
*Smooth the surface values: the stronger the smooth you will have less islands and but more pretty shapes, if weaker - more islands, more chaotic surfaces.
*One way to smooth the surface - make same size 2000x1000 array, and assign there values for each point as a average of a point and the 8 near points of the original array in the end copy the second array into the original, to get smoother surface - repeat the process multiple times.
*Determine that values from -10 to 0 it is water, 0 to 10 it is land, 10 to 20 is hills.
*Make function to show the surface of certain area.