Here's what _ARRAY_SHUFFLE uses:
Technically speaking, for Fisherâ€"Yates shuffle (see https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) a loop of length "size" is required, not "size/2-1".
Does it make sense to correct the shuffle so it implemets Fisher-Yates properly?
Code Auswählen
stop := UINT_TO_INT(SHR(size,2)-1);
FOR i := 0 TO stop DO
pos := RDM2(i+pos,0,stop);
(* swap elements *)
temp := pt^[i];
pt^[i] := pt^[pos];
pt^[pos] := temp;
END_FOR;
Technically speaking, for Fisherâ€"Yates shuffle (see https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) a loop of length "size" is required, not "size/2-1".
Does it make sense to correct the shuffle so it implemets Fisher-Yates properly?