unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Mask;
type
TForm1 = class(TForm)
ListBox1: TListBox;
GroupBox1: TGroupBox;
MaskEdit1: TMaskEdit;
SpeedButton1: TSpeedButton;
Label1: TLabel;
procedure SpeedButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
VAR
zahler1,zahler2,randomz,x,maxV,code1
:Integer;
r1,r2,a
: String;
begin
zahler1:=0;
zahler2:=0;
VAL (maskedit1.Text,maxV,code1);
{Beispiel}
repeat
randomz:=random(maxV);
str(randomz:4,r1);
listbox1.Items.Strings[zahler1]:=r1;
zahler1:=zahler1+1;
if zahler1>= 1 then
begin
zahler2:=0;
repeat
a:=listbox1.Items.Strings[zahler2];
Val(a,x,code1);
if randomz=x then
begin
repeat
randomz:=random(maxV);
until randomz<>x
end
else
listbox1.Items.Strings[zahler1]:=r1;
zahler2:=zahler2+1;
until zahler2=zahler1;
end;
UNTIL zahler1=maxV;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end.