well here's what I would do. Not sure if you'd like it, but Prelude taught me how to deal with random numbers. You should probably learn about what I'm doing.
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
// This function helps seed rand() more properly
unsigned time_seed(void)
{
time_t now = time ( 0 );
unsigned char *p = (unsigned char *)&now;
unsigned seed = 0;
size_t i;
for ( i = 0; i < sizeof now; i++ )
seed = seed * ( UCHAR_MAX + 2U ) + p[i];
return seed;
}
// This function just makes sure that we don't make other rolls
// occur more common than others
double uniform_distribution (int seed)
{
return seed * 1. / (RAND_MAX + 1.);
}
int main(void)
{
const char *die[10] =
{ "10-0", "11-1", "12-1", "13-2", "14-2", "15-3",
"16-3", "17-4", "18-4", "19-5", "20-5" };
srand(time_seed());
// Now, the dice roll still works the same, except you are working
// within the bounds of a string array.
int r = uniform_distribution(rand()) * 10;
cout << die[r];
cin.get();
return 0;
}