This is something I am very proud of, no matter how simple it is. Yes there might be easier ways to do this, but I like my way!
Anywho, I set off making a more random rand() function. And I came up with this:
I think it could use some fine tuning, but it is a pretty good start.Code:/******************************************************** * Power Rand beta version 4 * coded by Seth Collins * This function is a test of "Multiple Filter Randoms" * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * useing Filtered Randoms is takeing a random (usu seeded * to the time.) and using it to assign a number to another * variable, witch is used to either add to the time function * of another filter, or the "real seed". * The example below is a three-fold filtered random *********************************************************/ #include<iostream> #include<ctime> using namespace std; int main(void) { //Psudo-srands, these following are used in the filters. int WRand; //"White Rand the first to be used int BRand; // Black Rand the third to be used int GRand; // Grey Rand the Second to be used int MRand; // Mega Rand the Fourth to be used int QRand; // Quintte Rand the 5th to be used //This is the "real seed" int xRand; // The Number to be randomed int iNum; while(true) { iNum = 0; // the number is reset if(true){//forced if statment for organization srand(static_cast<unsigned int>(time(0))); // the root srand no modification WRand = rand()%10; //white random is assigned switch(WRand){//white rand switch case 0: GRand = 10; break; // Gray Random is assigned case 1: GRand = 9; break; case 2: GRand = 1; break; case 3: GRand = 8; break; case 4: GRand = 2; break; case 5: GRand = 7; break; case 6: GRand = 3; break; case 7: GRand = 6; break; case 8: GRand = 4; break; case 9: GRand = 5; break; default: cout << "WTF, mate? \n"; return -1; //error save } } if(true){ srand(static_cast<unsigned int>(time(0)+GRand)); // Gray Seeded BRand = rand()%10; // Black is assigned switch(BRand){// Black switch case 0: QRand = 2; break;// Quintte is assigned case 1: QRand = 5; break; case 2: QRand = 8; break; case 3: QRand = 6; break; case 4: QRand = 7; break; case 5: QRand = 3; break; case 6: QRand = 1; break; case 7: QRand = 0; break; case 8: QRand = 4; break; case 9: QRand = 9; break; default: cout << "WTF, mate? \n"; return -1; } } if(true){ srand(static_cast<unsigned int>(time(0)+QRand)); // Quintte Seeded MRand = rand()%10;// Mega assingned switch(MRand){//Mega Switch case 0: xRand = 100; break; // real srand assigned case 1: xRand = 10; break; case 2: xRand = 90; break; case 3: xRand = 80; break; case 4: xRand = 20; break; case 5: xRand = 70; break; case 6: xRand = 30; break; case 7: xRand = 60; break; case 8: xRand = 40; break; case 9: xRand = 50; break; default: cout << "WTF, mate? \n"; return -1; } } srand(static_cast<int>(time(0)+xRand));// Real Seed iNum = rand()%100+1;// iNum assigned cout << iNum << "\n\n";//output system("PAUSE");//pause for clarity } return 0;// exit }