One can not rely on various implementations of
rand
to give the same results. You might have better luck with the STL implementation of a pseudo-random number generator. Here is a snippet of the code I have used to do this.
std::random_device rd; std::mt19937_64 gen( rd() ); std::uniform_int_distribution< INT64 > rnd( 0, highestValue );
...
INT64 randomvalue = rnd( gen );
There are various types of generators and distributions available.
One other thing - you have used the magic number
5430
several places in your code. That is not recommend practice. It should be a constant value defined in ONE place and passed into various functions. It (the number 5430) should appear only once and that is in the definition of the constant value and that value should be given a descriptive name.