// [rangeL, rangeR]
int *generateRandomArray(int n, int rangeL, int rangeR) {
int *arr = new int[n];
srand(time(NULL));
for (int i = 0; i < n; I++) {
arr[i] = rand() % (rangeR - rangeL + 1) + rangeL;
}
return arr;
}
网友评论