Hola,
Ten en cuenta lo que dice la ayuda sobre el procedimiento "Randomize", entre otras cosas:
Cita:
|
Empezado por Ayuda de Delphi
Do not combine the call to Randomize in a loop with calls to the Random function. Typically, Randomize is called only once, before all calls to Random.
|
Es decir, más bien que esto:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
numeroAleatorioDelUnoAlCien: Integer;
begin
for i := 1 to 100 do
begin
Randomize;
numeroAleatorioDelUnoAlCien := Math.RandomRange(1, 100);
Caption := IntToStr(numeroAleatorioDelUnoAlCien);
end;
end;
... mejor hacer esto otro, o sea, quitar el "Randomize" del bucle:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
numeroAleatorioDelUnoAlCien: Integer;
begin
Randomize;
for i := 1 to 100 do
begin
numeroAleatorioDelUnoAlCien := Math.RandomRange(1, 100);
Caption := IntToStr(numeroAleatorioDelUnoAlCien);
end;
end;