I cannot seem to get the rand() function to work properly. Here is a sample of my code that asks for the number of sides of the die and then should generate a random number(a roll of the die) based on the number of sides. I keep getting the same number in the value variable. What am I doing wrong?
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int main()
{
int numSides;
int value;
cout << "Please enter the number of sides of the dice: ";
cin >> numSides;
value = rand() % numSides + 1;
cout << endl << value;
}