In pascal, i want to randomly organize an array. Therefore the majority of the time the array should be organized differently.
Consider this array setup
const
ARRAY_ELEMENTS = 3;
SetLength(iIndex, ARRAY_ELEMENTS);
for i := Low(iIndex) to High(iIndex) do
begin
case i of
0: iIndex[i] := 0;
1: iIndex[i] := 1;
2: iIndex[i] := 2;
end;
end;
How is it possible for the iIndex[]
that contains the value 0 not to always be in the first element of the array and for the iIndex[]
that contains value 2 not to be always the last value of the array but generate the order of the array randomly so that the order of the array is not always the same on initialization?