13 lines
256 B
C
13 lines
256 B
C
|
#include <stdlib.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
static int sort_rand_initialized = 0;
|
||
|
|
||
|
int gen_rand(int min, int max) {
|
||
|
if (sort_rand_initialized == 0) {
|
||
|
srand((unsigned int) time(NULL));
|
||
|
sort_rand_initialized = 1;
|
||
|
}
|
||
|
return rand() % (max + 1 - min) + min;
|
||
|
}
|