Hello everybody,
I am able to generate a number..
But i get for example number 5 and 6 a lot, and 1 or 3 never..
How could i optimized my random?
Thanks
Qt Code:
int max; while(count.next()) { max = count.value(0).toInt(); } //random int a = (1 + ( rand() % ( max - 1 + 1 ) ));To copy to clipboard, switch view to plain text mode


Reply With Quote

Did you use srand() first to set the seed of the random number generator? Because if you didn't your numbers will be likely predictable...

Bookmarks