function Random [ ( Range: Integer) ];DescriptionRandom returns a random number within the range 0 <= X < Range. If Range is not specified, the result is a real-type random number within the range就是返回一个>=0并且<Range的数值~~
procedure TForm1.Button1Click(Sender: TObject); const cCount = 10000; var I: Integer; S: Integer; begin Randomize; S := 0; for I := 1 to cCount do if Round(Sqrt(Sqr(Random(cCount)) + Sqr(Random(cCount)))) <= cCount then Inc(S); Caption := FloatToStr(cCount / (S * 4)); end;
const
cCount = 10000;
var
I: Integer;
S: Integer;
begin
Randomize;
S := 0;
for I := 1 to cCount do
if Round(Sqrt(Sqr(Random(cCount)) + Sqr(Random(cCount)))) <= cCount then Inc(S);
Caption := FloatToStr(cCount / (S * 4));
end;