Just like C, random number sequences are dependant on the the starting value - the seed - so if you create two sequences with the same seed they will be identical. Mostly, seeds are loaded from the system clock, so if you create two separate random instances at the same time, you will get the same sequence, even if you later use them an hour apart.
Look at your code: the chances are that you are using rand and srand badly and this is causing your problem.
This[
^] may help.
If you are using C#, as you suggest at the end of your question (or CLI C++) then you can use the
Random class[
^] from .NET, but in this case you should use and initialise the Random instance as a class member, not create it in a method / function as that will create the same problem as the srand mentioned above.