Skip to content

Commit

Permalink
Set range
Browse files Browse the repository at this point in the history
  • Loading branch information
swenson committed Feb 13, 2024
1 parent 1e72518 commit 1d9b547
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions stresstest.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ static __inline void srand48(long seed) {
x = seed;
}

#ifndef RAND_MAX
//#define RAND_MAX 0x7fffffff
#endif

static __inline long lrand48(void) {
return next() & 0x7fffffff;
// int x;
Expand Down Expand Up @@ -132,7 +136,7 @@ static void fill_random(int64_t *dst, const int size) {
int i;

for (i = 0; i < size; i++) {
//dst[i] = lrand48();
dst[i] = lrand48();
}
}

Expand Down Expand Up @@ -288,7 +292,7 @@ int run_tests(int64_t *sizes, int sizes_cnt, int type) {
double usec1, usec2, diff;
int64_t * dst = (int64_t *)malloc(MAXSIZE * sizeof(int64_t));
printf("-------\nRunning tests with %s:\n-------\n", test_names[type]);
TEST_SORT_H(quick_sort);
//TEST_SORT_H(quick_sort);
TEST_SORT_H(merge_sort);
//TEST_STDLIB(qsort);
// #if !defined(__linux__) && !defined(__CYGWIN__) && !defined(_WIN32)
Expand Down Expand Up @@ -432,10 +436,10 @@ int main(void) {
int64_t sizes[TESTS];
srand48(SEED);
//stable_tests();
//fill_random(sizes, TESTS);
fill_random(sizes, TESTS);

for (i = 0; i < TESTS; i++) {
//RAND_RANGE(sizes[i], 1, MAXSIZE);
RAND_RANGE(sizes[i], 1, MAXSIZE);
}

sizes[TESTS - 1] = MAXSIZE;
Expand Down

0 comments on commit 1d9b547

Please sign in to comment.