Monte Carlo methods: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
(2 intermediate revisions by one other user not shown)
Line 2,832:
 
=={{header|RPL}}==
≪ 0 1 3 PICK '''START'''
RAND SQ RAND SQ '''IF''' + 1 <3 '''THEN''' 1 +PICK '''END NEXTSTART'''
RAND SQ RAND SQ + 1 < +
SWAP / 4 *
'''NEXT'MCARL'''' STO
SWAP / 4 *
≫ '<span style="color:blue">MCARL</span>' STO
 
100 '''<span style="color:blue">MCARL'''</span>
1000 <span style="color:blue">MCARL</span>
10000 '''MCARL'''
10000 '''<span style="color:blue">MCARL'''</span>
100000 <span style="color:blue">MCARL</span>
500000 '''MCARL'''
{{out}}
<pre>
4: 3.162
3: 3.166084
2: 3.12281684
1: 3.14371214154
</pre>
 
Line 3,217 ⟶ 3,219:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "random" for Random
import "./fmt" for Fmt
 
var rand = Random.new()
9,485

edits