/***************************************************************************** * Outputs random numbers, until a duplicate is produced. * * Inputed: * * Outputed: temp, how_many * * Written: June 22, 2002 * * By: Ronald Roberts * *****************************************************************************/ /* Compiler Directives */ #include #include #include #include #include /* Random Number Function Prototype */ double randomfunction(int modulator, double shifter); /* Random Number Function */ double randomfunction(int modulator, double shifter) { return rand()%modulator+shifter; } /* Main Program */ int main() { /* Variable Declatations */ int modulator=100, shifter=1, how_many=0, random[50]={0}, temp=0, trip=0; /* Initiates Random Numbering */ srand((unsigned)time(NULL)); /* Outer FOR Loop Controls Which Level We Are At In The random[] Array */ for (int i=0; i<50; i++) { temp=randomfunction(modulator, shifter); /* Inner FOR Loop Is Used To Check Every Number In Used Levels Of The random[] Array */ for (int j=0; j<=how_many; j++) { /* Checks Array For Duplication */ if (temp==random[j]) { /* Adds One To how_many, Sets Trip Flag To True(1), ouputs temp and how_many. */ how_many++; trip=1; cout<