create random mines for a minesweeper game
<pre><code> JButton[][] buttons = new JButton[20][20];
public void mines(){
    ArrayList&lt;Integer&gt; x = new ArrayList&lt;&gt;();
    ArrayList&lt;Integer&gt; y = new ArrayList&lt;&gt;();
    for(int a=0;a&lt;20;a++){
        x.add(a);
        y.add(a);
    }
    for(int i=0;i&lt;30;i++){
    int random_x = x.get(new Random().nextInt(x.size()));
    int random_y = y.get(new Random().nextInt(y.size()));
    x.remove(random_x);
    y.remove(random_y);
    buttons[random_x][random_y].setText("X");
    }  
}
</code></pre>

<p>I Want to create random mines for a minesweeper game..can anyone tell what I am doing wrong ?If i run the program it won't show me 30 random mines </p>