declare @i int , @x float , @y float , @r int , @in_count float , @out_count float set @r = 100 set @i = 1 set @in_count = 0 set @out_count = 0 while(@i <= 10000) begin set @x = rand() * @r set @y = rand() * @r if sqrt(@x*@x + @y*@y) > @r set @out_count += 1 else set @in_count += 1 set @i += 1 end print @in_count/@i * 4 --2覿覃企 朱襦 4襯 螻燕伎.