unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var T: TDateTime;
C: Int64;
S: Integer;
W: Byte;
H: Cardinal;
F: Boolean;
const Start = - MaxInt;
ZF:
Array[0..32]
of Byte = (8, 1, 9, 1, 1, 8, 4, 0, 3, 9, 5, 0, 0, 2, 3, 1, 8, 9, 3, 7, 9, 6, 7, 6, 3, 8, 9, 5, 7, 1, 4, 7);
begin
//find start seed and "last" seed
T := Now;
RandSeed := Start;
C := 0;
repeat
S := RandSeed;
For H:=Low(ZF)
to High(ZF)
do
begin
W := Random(10);
F := (W=ZF[H]);
if not F
then break;
end;
inc(C);
until
(RandSeed=Start)
or F;
T := Now - T;
Showmessage( '
Needed Time: ' + FormatDateTime('
hh:nn:ss.zzz', T) +#13#10+
'
Needed Runs: ' + IntToStr(C) +#13#10 +
'
Last Seed: ' + IntToStr(RandSeed) +#13#10+
'
StartSeed: ' + IntToStr( S ) );
end;
end.