srand() allows you to seed the random number generator rand(). If instead you use the default seed, you will get the same sequence of random numbers everytime you run your program. Typically, you seed rand() with the current time--in the form of the number of milliseconds since 1970. You can do that with the time() function: time(0). #include <cstdlib>, <ctime>.

#include<iostream>
#include<vector>
#include<algorithm> //random_shuffle()
#include<ctime> //time()
using namespace std;
int main()
{
//A vector is just like an array.
//You declare one by using the word "vector"
//and putting the type of the elements it will
//contain between angled brackets. Then give it a
//name and a size:
vector<int> myNums(8);
//Put the numbers 1-8 in the vector:
for(int i = 0; i < 8; i++)
{
myNums[i] = i + 1;
}
//Seed the random number generator:
srand(time(0));
//Shuffle the vector between the elements specified:
random_shuffle(myNums.begin(), myNums.end());
//Display the first two values in the shuffled vector:
cout<<"You rolled a "<<myNums[0]<<" and a "<<myNums[1]<<endl;
return 0;
}

7stud, your way doesn't match the scenario of rolling two dice. If you have two dice, you are allowed to have both dice give the same result. Using random_shuffle is more appropriate for doing a card game where each card is dealt and you cannot deal duplicate cards.

To simulate rolling two dice, just use rand() twice. The easiest way to do this is (rand() % 8 + 1), once for each die.

Once you get into all those issues, it gets complicated real fast. I think it's conceptually simpler to modify the code I posted to read a number out of the shuffled vector, then shuffle again and read another number. But, ultimately that's up to findme to decide.