hey does anyone know if i am using the srand() fucntion correctly to randomly choose if a persons letter is X or O?
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
srand(time(0));
int playerTurn = rand() % 2;
char initPname;
if (playerTurn == 1)
{
initPname= 'X';
playerTurn++;
cout << "Your Letter is X.";
} else
{
initPname = 'O';
playerTurn--;
cout << "Your letter is O.";
}
return 0;
}