I'm trying to make a game with dice, and I need to have random numbers in it (to simulate the sides of the die. I know how to make it between 1 and 6). Using
using namespace std;
i = (rand()%6)+1;
cout << i << "\n";
The most fundamental problem of your test application is that you call
srand once and then call
rand one time and exit.
The whole point of
srand function is to initialize the sequence of pseudo-random numbers with a random seed. It means that if you pass the same value to
srand in two different applications (with the same
rand implementation) you will get exactly the same sequence of
rand() values read after that. But your pseudo-random sequence consists of one element only - your output consists of the first elements of different pseudo-random sequences seeded with time of 1 second precision. So what do you expect to see? When you happen to run application on the same second your result is the same of course (as Loki Astari already mentioned in a comment to the answer).
Actually you should call
srand(seed) one time and then call
rand() many times and analyze that sequence - it should look random.