okay, it's pretty standard practice to useto seed your PRNG (ignore the downsides to rand() for the moment).Code:srand(static_cast<unsigned int>(time(0)));
but I was wondering if there was some other (portable) way to create another seed. for example, I have two programs, one a bubble sort and one a quicksort. when I run them like so:the PRNG creates the same set of values in each program. now I know that's to be expected because they're using the same seed in that context, but I was wondering if there was something else I could use in case I wanted to force two programs that seed their generators at the same time to end up with a different data set (making the code for each program different isn't an option - the only difference I want in the code is the sort() method of their respective classes)Code:jshao@MCP ~/Programming/C++/quickSort $ ./QuickSort && ../bubbleSort/BubbleSort
basically, my question is this: I need to seed two generators (pretty much) at the same time and have them come up with different values, but the code for both needs to be the same (and it has to be portable, so /dev/random isn't acceptable), and I don't want to add any devices that create noise or anything of the sort...
I'm not sure if this is even really possible, becuase the only way I can think is to introduce another "random" variable into the equation, but that's not possible (for obvious reasons), and I can't think of another non-random variable (like time(0)) that would suffice...
edit: I know this isn't strictly C++, so if a mod feels there's a better place for this, please move it.