mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
service_nodes: Fix regression in RNG not using same seed
This commit is contained in:
parent
f53560a022
commit
6c000f9c90
1 changed files with 2 additions and 1 deletions
|
@ -1443,8 +1443,9 @@ namespace service_nodes
|
|||
// reuse the same seed for both partial shuffles, but again, that isn't an issue.
|
||||
if ((0 < sublist_size && sublist_size < list_size) && (0 < sublist_up_to && sublist_up_to < list_size)) {
|
||||
assert(sublist_size <= sublist_up_to); // Can't select N random items from M items when M < N
|
||||
auto rng_copy = rng;
|
||||
tools::shuffle_portable(result.begin(), result.begin() + sublist_up_to, rng);
|
||||
tools::shuffle_portable(result.begin() + sublist_size, result.end(), rng);
|
||||
tools::shuffle_portable(result.begin() + sublist_size, result.end(), rng_copy);
|
||||
}
|
||||
else {
|
||||
tools::shuffle_portable(result.begin(), result.end(), rng);
|
||||
|
|
Loading…
Reference in a new issue