Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Monte-Carlo-methods/AWK/monte-carlo-methods.awk
Normal file
10
Task/Monte-Carlo-methods/AWK/monte-carlo-methods.awk
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# --- with command line argument "throws" ---
|
||||
|
||||
BEGIN{ th=ARGV[1];
|
||||
for(i=0; i<th; i++) cin += (rand()^2 + rand()^2) < 1
|
||||
printf("Pi = %8.5f\n",4*cin/th)
|
||||
}
|
||||
|
||||
usage: awk -f pi 2300
|
||||
|
||||
Pi = 3.14333
|
||||
Loading…
Add table
Add a link
Reference in a new issue