Skip to content

Commit

Permalink
set rand max always
Browse files Browse the repository at this point in the history
  • Loading branch information
swenson committed Feb 13, 2024
1 parent f8da358 commit a1578ee
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions stresstest.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define TESTS 1000

#define RAND_RANGE(__n, __min, __max) \
(__n) = (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / (RAND_MAX + 1.0)))
(__n) = (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / (0x7fffffff + 1.0)))

enum {
FILL_RANDOM,
Expand Down Expand Up @@ -92,10 +92,6 @@ 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

0 comments on commit a1578ee

Please sign in to comment.