Create random circles in a grid

Hey thanks for the base.
What is preset() used for? Because the same code works without this one.

Also how do I make several of them using a variable?
I’m currently trying this

void drawmines() {
  for (int i = 0; i < drawmines; i++) {
    setrandom();
  }
}

png
This is how my start menu looks like, I can increase the amount of mines drawn with the right one and decrease the mines with the left one.
However whenever I go to the main game it doesn’t use the value given in the start menu but takes the value set in the variable when running this program.