Subject | Re: [firebird-support] udf firebird delphi |
---|---|
Author | Dan Wilson |
Post date | 2004-03-31T18:50:10Z |
Hi Marc,
removing all the layers or >>> reply flags, your code reads:
for i:=Length(Str) downto 1 do
begin
j:=Random(i)+1;
c1:=Str[i];
Str[i]:=Str[j];
Str[j]:=c1;
end;
I'm not a Delphi guru, but where do you guarantee in the above code that j will be less than or equal to Length(Str)? Can you not end up attempting to copy characters from outside the valid range of the string?
HTH and that I'm not barking up the wrong tree,
Dan.
removing all the layers or >>> reply flags, your code reads:
for i:=Length(Str) downto 1 do
begin
j:=Random(i)+1;
c1:=Str[i];
Str[i]:=Str[j];
Str[j]:=c1;
end;
I'm not a Delphi guru, but where do you guarantee in the above code that j will be less than or equal to Length(Str)? Can you not end up attempting to copy characters from outside the valid range of the string?
HTH and that I'm not barking up the wrong tree,
Dan.