Einzelnen Beitrag anzeigen

Benutzerbild von zecke
zecke

Registriert seit: 17. Jan 2004
494 Beiträge
 
Turbo Delphi für Win32
 
#6

Re: Lottogenerator

  Alt 28. Feb 2007, 17:44


ich habe mal so etwas gemacht und habe nichts wirklich besseres gefunden, als du schon sagtest. bin aber nicht gerade ein delphi-meister. vielleicht hilft dir mein code trotzdem weiter:

Delphi-Quellcode:

var zahl1,zahl2,zahl3,zahl4,zahl5,zahl6 : integer;

// etc...

function zahlenziehen():integer;
begin
// Zufallsgenerator neu
randomize;

// Zahlen zuweisen
zahl11:=random(49)+1;

begin
  repeat
      zahl2:=random(49)+1;
  until
      zahl1<>zahl2;
end;

begin
  repeat
      zahl3:=random(49)+1;
  until
      (zahl1<>zahl3) and (zahl2<>zahl3);
end;
begin
  repeat
      zahl4:=random(49)+1;
  until
      (zahl1<>zahl4) and (zahl2<>zahl4) and (zahl3<>zahl4);
end;
begin
  repeat
      zahl5:=random(49)+1;
  until
      (zahl1<>zahl5) and (zahl1<>zahl5) and (zahl3<>zahl5) and (zahl4<>zahl5);
end;
begin
  repeat
      zahl6:=random(49)+1;
  until
      (zahl1<>zahl6) and (zahl2<>zahl6) and (zahl3<>zahl6) and (zahl4<>zahl6) and (zahl5<>zahl6);
end;
end;
mfg zecke
  Mit Zitat antworten Zitat