I'm not sure how it is done using .NET (VS2005 is .NET), but in normal C++, it can be done the following way:
Code:
// iostream - IO functions
// cstdlib - stdlib.h (C header); used for srand and rand functions
// ctime - time.h (C header); used for time function as argument to srand
#include <iostream>
#include <cstdlib>
#include <ctime>
//constants for the maximum/minimum values of the generated number
// only change the MAX_VAL and MIN_VAL. everything else should be fine.
#define MAX_VAL 6
#define MIN_VAL 1
#define RANGE (MAX_VAL - MIN_VAL + 1)
using std::cout;
using std::endl;
int main () {
// seed the random number generator with current time as unsigned value
srand((unsigned)time(0));
//a simple bit of math for a random value between two integers
// (you can find others if you want a better one
// as this is not exactly random enough sometimes)
cout << ((rand() % RANGE) + MIN_VAL) << endl;
return 0;
}