function RandString(s: string; Min, Max: Integer): string;
var
count, i, r : Integer;
begin
Result := '';
if ((Max - Min) > 0) then
begin
count := Random(Max - Min + 1) + Min;
for i := 0 to count - 1 do
begin
r := Random(Length(s)) + 1;
Result := Result + s[r];
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(RandString('ABCDEFGHIJKLMN',9,10));
end;