M_Shuffle_UINT16: Fix to not rule out half of all possible Spray Can orders

This commit is contained in:
toaster 2023-08-23 17:08:06 +01:00
parent e1b7cb66cb
commit 53549bfa2d

View file

@ -661,9 +661,14 @@ static void M_Shuffle_UINT16(UINT16 *list, size_t len)
{ {
size_t i; size_t i;
UINT16 temp; UINT16 temp;
while (--len > 1) // no need to swap on ==
while (len > 1)
{ {
i = M_RandomKey(len); i = M_RandomKey(len);
if (i == --len)
continue;
temp = list[i]; temp = list[i];
list[i] = list[len]; list[i] = list[len];
list[len] = temp; list[len] = temp;