procedure Gera: String;
var
   c: Char;
   s: String;
begin

   Randomize;
   s:='';
   while true do begin
      c:=char(random(91));
      if c in ['0'..'9'] then
         s:=s + c
      else if c in ['A'..'Z'] then
         s:=s + c;

      if length(s) = 6 then
         break;
   end;
end;

Responder a