Comando ===gt; Random

Delphi

30/10/2003

Tem como forçar um numero gerado pelo comando Random ter 16 digitos .. tipo

Random(9999999999999999);

Resultado := 1875634251895482


Marcelo Bh

Marcelo Bh

Curtidas 0

Respostas

Motta

Motta

30/10/2003

tente isto , nao testei

procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;

str: string;
max=16;
begin
str=´123456789´
Edit1.Text:=´´;
for i:=1 to max do
begin
Edit1.Text:=Edit1.Text+str[random(length(str))+1];
if I = 1 then
str := str + ´0´;
end;
end;


GOSTEI 0
POSTAR