11 ms·
F# version that fits in a tweet: let r,n=Random(),1e7 let d()=(r.NextDouble()-0.5)**2.0 [0.0..n] |>Seq.sumBy(function _ when d()+d()<0.25->4.0/n|_->0.0
by endeavour 10y ago
F# version that fits in a tweet:
let r,n=Random(),1e7
let d()=(r.NextDouble()-0.5)**2.0
[0.0..n]
|>Seq.sumBy(function _ when d()+d()<0.25->4.0/n|_->0.0)
|>printfn "%f"