hidrau
asked on
Is there any way to turn this function into a generic function for records?
Hello guys
I have this function that Shaffler my array of record
But I'd like to turn it into in a generic function for any kind of record. Something like this:
procedure ShufflerArray(variable: record)
is it possible? if so, how to?
Thanks
Alex
I have this function that Shaffler my array of record
procedure DoSwap(var s1, s2: TCadVb);
var
tmp: TCadVb;
begin
tmp := s1;
s1 := s2;
s2 := tmp;
end;
procedure ShuffleArrayCadVb;
var
i, j : Integer;
Begin
for i := Low(CadVb) to High(CadVb) do
begin
j := Random(High(CadVb) - Low(CadVb) + 1) + Low(CadVb);
if i <> j then
DoSwap(CadVb[i], CadVb[j]);
end;
End;
But I'd like to turn it into in a generic function for any kind of record. Something like this:
procedure ShufflerArray(variable: record)
is it possible? if so, how to?
Thanks
Alex
ASKER
Could you give me an example?
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much for your example
It helped me a lot
It helped me a lot
mlmcc