Einzelnen Beitrag anzeigen

Dax
(Gast)

n/a Beiträge
 
#7

Re: Zufalsgenerator - Zahlen auslassen ?

  Alt 20. Okt 2004, 10:06
Oh... so stimmts:
Delphi-Quellcode:
var Used: array[1..10] of Integer; i, x, t: Integer;
begin
  Randomize;
  i := 1;
  FillChar(Used[1], 10*sizeof(Uses[1]), 0);
  while i <> 11 do
  begin
    t := Random(10)+1;
    for x := 1 to i do
      if Used[x] = t then Break;
    if x = i+1 then
    begin
      Used[i] := t;
      Inc(i);
    end;
  end;
end;
  Mit Zitat antworten Zitat