Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 02-10-2006
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.142
Poder: 36
dec Tiene un aura espectaculardec Tiene un aura espectacular
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;
__________________
David Esperalta
www.decsoftutils.com
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 02:10:45.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi