Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Monte-Carlo-methods/AutoHotkey/monte-carlo-methods.ahk
Normal file
12
Task/Monte-Carlo-methods/AutoHotkey/monte-carlo-methods.ahk
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
MsgBox % MontePi(10000) ; 3.154400
|
||||
MsgBox % MontePi(100000) ; 3.142040
|
||||
MsgBox % MontePi(1000000) ; 3.142096
|
||||
|
||||
MontePi(n) {
|
||||
Loop %n% {
|
||||
Random x, -1, 1.0
|
||||
Random y, -1, 1.0
|
||||
p += x*x+y*y < 1
|
||||
}
|
||||
Return 4*p/n
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue