jimbo
6th November 2015, 19:46
Hello,
I'm using the code shown to generate random numbers.
timeval ti;
gettimeofday(&ti, NULL);
qsrand(qsrand((long long)ti.tv_usec * (long long)ti.tv_sec);
qDebug() << (long long)((long long)ti.tv_usec * (long long)ti.tv_sec);
num = (rand() % maxNum + 1);
1151813750172254
1152103117531054
1020841750830240
1033346761335855
Is there any difference to the result in using:-
qsrand((long long)ti.tv_usec * (long long)ti.tv_sec);
against
qsrand(ti.tv_usec * ti.tv_sec);
Both seem to give acceptable results.
Regards
I'm using the code shown to generate random numbers.
timeval ti;
gettimeofday(&ti, NULL);
qsrand(qsrand((long long)ti.tv_usec * (long long)ti.tv_sec);
qDebug() << (long long)((long long)ti.tv_usec * (long long)ti.tv_sec);
num = (rand() % maxNum + 1);
1151813750172254
1152103117531054
1020841750830240
1033346761335855
Is there any difference to the result in using:-
qsrand((long long)ti.tv_usec * (long long)ti.tv_sec);
against
qsrand(ti.tv_usec * ti.tv_sec);
Both seem to give acceptable results.
Regards