⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flysquare.m

📁 一些常被用于教学或者参考的概率论的实例的源代码
💻 M
字号:
%flysquare.m/created by PJNahin for "Duelling Idiots"(1/19/99)
%This m-file simulates the distance-squared between 100,000
%pairs of flies, landing at random in the unit square.
%
%
rand('state',100*sum(clock))
summation=0;
for fly=1:100000
   x1=rand;
   y1=rand;
   x2=rand;
   y2=rand;
   distance2=(x1-x2)^2+(y1-y2)^2;
   if distance2>=1
      summation=summation+1;
   end
end
summation/100000

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -