diff options
author | Ben Pfaff <blp@nicira.com> | 2013-06-25 09:22:11 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-06-28 16:09:39 -0700 |
commit | b028db44ca684fbd5361001dc3ed543a37374fbb (patch) | |
tree | c0b0d66a5bea69c498efbbcd39b6eb24d3343a0c /tests/test-hindex.c | |
parent | 61d71ceb5d45e6caeaf08a63efeba931a10b32f3 (diff) |
Use random_*() instead of rand(), for thread safety.
None of these test programs are threaded, but has little cost and means
that "grep" doesn't turn up any instances of these thread-unsafe functions
in our tree.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests/test-hindex.c')
-rw-r--r-- | tests/test-hindex.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test-hindex.c b/tests/test-hindex.c index b5fe9f01..7a3ef721 100644 --- a/tests/test-hindex.c +++ b/tests/test-hindex.c @@ -21,6 +21,7 @@ #include "hindex.h" #include <string.h> #include "hash.h" +#include "random.h" #include "util.h" #undef NDEBUG @@ -108,7 +109,7 @@ static void shuffle(int *p, size_t n) { for (; n > 1; n--, p++) { - int *q = &p[rand() % n]; + int *q = &p[random_range(n)]; int tmp = *p; *p = *q; *q = tmp; |