A simple method is to create a 10*10 array of booleans to false (being devoid of mines). Then you just need to pick 20 random (x,y) integer pairs (use the Random class or Math.random) and set those...