unit f_function;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit5: TEdit;
Label4: TLabel;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
f_width1,f_width2, f_hight, temp, sum, part : real;
f_time,i : integer;
sum1:extended;
implementation
{$R *.DFM}
procedure ff_function(n : integer);
const range = 10000;
var
i:real;
j,k,h,r1,r2: integer;
is_in: boolean;
s: array[1..range] of real;
DateTime : TDateTime;
Hour,Min,Sec,MSec : word;
begin
part := n;
h:= 1;
Randomize;
for k := 1 to range do
begin
DateTime:= Now;
Decode
Time(DateTime, Hour, Min, Sec, MSec);
r1 := Msec;
j := Random(r1) mod 164500;
{ j := ( 101*r1 + 300*r2) mod 164500;}
i:= j/100000;
{ is_in := false;|
s[h] := i;
h:= h+1;
r1 := 13+(r1*(h mod 537) +11) mod 501;
r2 := 11+(r2*(h mod 311) +13) mod 703;}
end;
for f_time := 1 to n do
begin
f_width2 := s[f_time];
f_hight := (1/sqrt(2*pi))*Exp((-(sqr(f_width2)))/2);
sum := sum + f_hight;
end;
{ Edit1.text :=FloatToStr(sum1);}
sum := (sum / n) * 1.645;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
tt: string;
yy: array[1..14] of char;
ij: integer;
begin
i := StrToInt(Edit2.Text);
ff_function(i);
Edit3.text := FloatToStr(f_width2);
Edit4.text := FloatToStr(f_hight);
Edit5.text := FloatToStr(temp);
tt := FloatToStr(sum);
for ij := 1 to 8 do
yy[ij] :=tt[ij];
Edit1.text := yy;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
end.