?? unit2.pas
字號:
unit Unit2;
interface
uses
unit1;
Function GASDEV:real;
procedure AVEVAR(DATA:array of real; N:integer; var AVE, VAR1:real);
implementation
Function GASDEV:real;
var
V1,V2,FAC,R:real;
begin
If ISET^= 0 Then
begin
repeat
V1:=2 * Random - 1;
V2:=2 * Random - 1;
R:=Sqr(V1) + Sqr(V2);
until (R < 1);
FAC:=Sqrt(-2 * Ln(R) / R);
GSET^:=V1 * FAC;
GASDEV:=V2 * FAC;
ISET^:=1;
end
Else
begin
GASDEV:=GSET^;
ISET^:=0;
end;
end;
procedure AVEVAR(DATA:array of real; N:integer; var AVE, VAR1:real);
var
J:integer; S:real;
begin
AVE:=0;
VAR1:=0;
For J:=1 To N do
AVE:=AVE + DATA[J];
AVE:=AVE / N;
For J:=1 To N do
begin
S:=DATA[J] - AVE;
VAR1:=VAR1 + S * S;
end;
VAR1:=VAR1 / (N - 1);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -