Ver Mensaje Individual
  #13  
Antiguo 19-10-2016
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
De entrada, el orden de los FOR parece estar alrevés: por cada una de las cien líneas debes hallar seis números. Y entonces faltaría crear esos seis números por cada línea (TAlea.Create sólo se llama una vez).

Mira este ejemplo, a ver si te vale:

Código Delphi [-]
type
  TIntegerArray = array of Integer;

function RandomArray(AMin, AMax: Integer; ACount: Word): TIntegerArray;
var
  Found: Boolean;
  Max, N, I, J: Integer;

begin
  Max := AMax - AMin + 1;

  if ACount > Max then
    raise Exception.Create('There are more pigeons than holes');

  SetLength(Result, ACount);

  Result[0] := Random(Max) + AMin;

  for I := 1 to ACount - 1 do
  begin
    repeat
      Found := true;
      N := Random(Max) + AMin;

      for J := 0 to I - 1 do
        if (Result[J] = N) then
        begin
          Found := false;
          break;
        end;
    until Found;

    Result[i] := N;
  end;
end;

La función RandomArray te genera ACount números enteros en el rango AMin..AMax.

Lo puedes usar así:

Código Delphi [-]
var
  A: TIntegerArray;
  I, J: Integer;
  Item: TListItem;

begin
  ListView1.Clear;

  for I := 1 to 100 do
  begin
    A := RandomArray(1, 49, 6);
    Item := ListView1.Items.Add;
    Item.Caption := IntToStr(A[0]);

    for J := 2 to 5 do
      Item.SubItems.Add(IntToStr(A[J]));
  end;
end;

Edito:
No había visto el mensaje de Reasen. Ahora ya tienes dos opciones

LineComment Saludos

Última edición por roman fecha: 19-10-2016 a las 19:21:46.
Responder Con Cita