]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Improve shuffling algorithm of connection list
authorShuji Furukawa <shujifurukawa1213@gmail.com>
Mon, 18 Nov 2024 14:20:20 +0000 (23:20 +0900)
committerGert Doering <gert@greenie.muc.de>
Sun, 29 Dec 2024 12:22:34 +0000 (13:22 +0100)
commit9502e5257c59bfd23b9afcdb28f7994470591430
tree6c0a34e466e251b484c1920eb538795f6f611407
parent115058d2d586ad19956d7ee119ca438b1c5a985a
Improve shuffling algorithm of connection list

This patch implements the Fisher-Yates shuffle algorithm to ensure that all
permutations of the connection target list are generated with equal
probability, eliminating biases present in the previous shuffling method. In
the Fisher-Yates algorithm, there's only one way to obtain each permutation
through a series of element swaps, so all permutations occur with equal
probability in theory.

Signed-off-by: Shuji Furukawa <shujifurukawa1213@gmail.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20241118142019.31045-1-shujifurukawa1213@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29837.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c