Ver Mensaje Individual
  #6  
Antiguo 08-12-2003
Avatar de __hector
[__hector] __hector is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Santo Domingo, Rep. Dom.
Posts: 1.075
Reputación: 23
__hector Va por buen camino
Vamos, que es una funcion sencilla de implementar. Supongamos tu segundo caso, el de que metes los numeros en un memo, nos construimos una funcion, digamos yaestaenMemo, que nos dira si el numero existe o no, asi que solo tendriamos que hacer:

Código:
var
  CantidadNumeros : integer; 
...

Randomize;
   if not yaestaenMemo(random(StrToInt(Edit2.Text)) + 1) then
     Memo1.Lines.Add(edit2.text);
end;
y la funcion

Código:
 
function yaestaenMemo (valor : integer): boolean;
var
  m : integer;
  resultado : boolean;
begin
   resultado := False;
   with form1 do
     for m := 0 to memo1.Lines.Count - 1 do
      if (strtoint(memo1.Lines[m]) = valor) then
         resultado := true;

  result := resultado;
end;
Asi, a groso modo.
__________________
Héctor Geraldino
Software Engineer
Responder Con Cita