Hello,
So, I've been trying to make one of my program open separate instances of another program I made. Let me show you what I'm trying to do.
Program A has a for loop that opens Program B ten times.
Program B prints out a RANDOM sequence of numbers and characters.
The problem I'm having is that after running Program A, the ten CMD windows of Program B have the same exact random values. I've been using CreateProcess(), ShellExecute() and system(), yet I'm still running into the same problem. Any help would be appreciated.
You either forgot to call srand or used time(0) as a seed. Since time(0) returns the number of seconds passed since Jan 01 1970, the value it returns only changes every second. So if you execute the program ten times within the same second, the numbers that are generated will be the same.
Use the low part of QueryPerformanceCounter or the RDTSC instruction instead.