jeudi 5 décembre 2019

How to use random numbers in C++? [duplicate]

This question already has an answer here:

I know there are similar posts like this but I cannot get my code to work. How can I go about making this actually random. It is for my minesweeper game for class.

int rNum = (rand() % 10) + 1;
if (rNum == 1 || rNum == 2)
{
    grid[i][j] = 9; // mines are 9
}



Aucun commentaire:

Enregistrer un commentaire