ok so i searched around for a while and found a simple, working random number generating function. however, i am getting the same number over and over again and it would greatly appreciated if someone could help me get actual random numbers. what am i missing?
this is the simplified code i have so far to just get a random number from 2 dice:
.................................................. .........................................
Code:#include <cstdlib> #include <iostream> #include <strings.h> #include <hat.h> #include <ctime> /*i know some of these includes are not needed for the task at hand i am using them for another aspect of the program*/ using std::cout; using std::rand; using namespace std; int main(int argc, char *argv[]) { int firstdie; int secdie; const int HIGH=6; const int LOW=1; firstdie = rand() % (HIGH - LOW); secdie = rand() % (HIGH - LOW); cout <<firstdie<<endl<<endl<<secdie; system("PAUSE"); return EXIT_SUCCESS; }
.................................................. .........................................



LinkBack URL
About LinkBacks


