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
hmap_random_node: Improve distribution
[sliver-openvswitch.git]
/
lib
/
hmap.c
diff --git
a/lib/hmap.c
b/lib/hmap.c
index
ec1de67
..
542d8b5
100644
(file)
--- a/
lib/hmap.c
+++ b/
lib/hmap.c
@@
-214,8
+214,8
@@
hmap_random_node(const struct hmap *hmap)
size_t n, i;
/* Choose a random non-empty bucket. */
- for (
i = random_uint32(); ; i++
) {
- bucket = hmap->buckets[
i
& hmap->mask];
+ for (
;;
) {
+ bucket = hmap->buckets[
random_uint32()
& hmap->mask];
if (bucket) {
break;
}