I have a big problem , I do not understand.
I need to generate random numbers from the interval.
I am using code:
unsigned int nahodnyCisloZIntervalu(unsigned int min, unsigned int max) {
int r;
const unsigned int range = 1 + max - min;
const unsigned int buckets = RAND_MAX / range;
const unsigned int limit = buckets * range;
do {
r = rand();
} while (r >= limit);
return min + (r / buckets);
}
But every time you start the program generates the same numbers!
How to generate truly random numbers usnig C
?