Алгоритм достаточно прост. Как и его реализация ;)

function HexStr(L:LongInt):string;
begin
 Result:=Format('%x',[L]);
 if (Length(Result) mod 2)>0 then Result:='0'+Result;
end;

Function genGUID:string;
Var i:integer; 
      B:Byte;
Begin
  Result:='';
  for i:=1 to 16 do
    begin
      B:=round(random($FF));
      case I of
       7: B:=(B and $0F) or $40; 
       9: B:=(B and $3F) or $80;    
      end;
     Result:=Result+HexStr(B);
     if I in [4,6,8,10] then Result:=Result+'-';
    End;
End;

//-------------
Var I:integer;
Begin
  randomize;
  for i:=1 to 10 do writeln(genGUID);
End.


WBR,Dmitry Beloshistov AKA [-=BDS=-] 

Ответить