git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use random_*() instead of rand(), for thread safety.
[sliver-openvswitch.git]
/
tests
/
test-util.c
diff --git
a/tests/test-util.c
b/tests/test-util.c
index
3422af3
..
5afe2f7
100644
(file)
--- a/
tests/test-util.c
+++ b/
tests/test-util.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2011, 2012
, 2013
Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-94,7
+94,7
@@
static void
shuffle(unsigned int *p, size_t n)
{
for (; n > 1; n--, p++) {
shuffle(unsigned int *p, size_t n)
{
for (; n > 1; n--, p++) {
- unsigned int *q = &p[rand
() % n
];
+ unsigned int *q = &p[rand
om_range(n)
];
unsigned int tmp = *p;
*p = *q;
*q = tmp;
unsigned int tmp = *p;
*p = *q;
*q = tmp;
@@
-297,7
+297,7
@@
test_bitwise_is_all_zeros(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
/* Change a random 0-bit into a 1-bit. */
do {
/* Change a random 0-bit into a 1-bit. */
do {
- bit = htonll(UINT64_C(1) << (random_
uint32() % 64
));
+ bit = htonll(UINT64_C(1) << (random_
range(64)
));
} while (x & bit);
x |= bit;
} while (x & bit);
x |= bit;