# \[ANN\] QuasiMonteCarlo.jl

**URL:** <https://discourse.julialang.org/t/ann-quasimontecarlo-jl/28343>\
**Category:** Modelling & Simulations\
**Tags:** announcement\
**Created:** [September 3, 2019, 6:48pm UTC](https://discourse.julialang.org/t/ann-quasimontecarlo-jl/28343 "2019-09-03T18:48:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cscherrer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cscherrer/32/7631_2.png) [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Post date:** [September 3, 2019, 6:48pm UTC](https://discourse.julialang.org/t/ann-quasimontecarlo-jl/28343/1 "2019-09-03T18:48:24Z")

</div>

I’ve started a library to make it convenient to do quasi Monte Carlo simulations. This leverages @stevengj’s [Sobol.jl](https://github.com/stevengj/Sobol.jl), @tkf’s [Transducers.jl](https://github.com/tkf/Transducers.jl), and Mose Giordano et al’s [Measurements.jl](https://github.com/JuliaPhysics/Measurements.jl)

EDIT: Forgot to link to it: [QuasiMonteCarlo.jl](https://github.com/cscherrer/QuasiMonteCarlo.jl)

Here’s a little example:

```julia
julia> incircle(x) = transpose(x) * x < 1
incircle (generic function with 1 method)

julia> computeπ(tol) = foldl(right, 
              Map(incircle) 
           |> Mean() 
           |> Drop(10) 
           |> Map(x -> x*4) 
           |> TakeWhile(x -> x.err > tol)
           , Quasi(2)
           )
computeπ (generic function with 1 method)

julia> computeπ(0.001)
3.1417 ± 0.001

```

I’m moving toward implementing other distributions as well; here’s a little demo with normals:

```julia
julia> collect(Map(x -> x[1]) |> Mean() |> Take(10), StdNormals(1))
10-element Array{Measurements.Measurement{Float64},1}:
   0.0 ± 0.0 
  0.34 ± 0.24
  -0.0 ± 0.32
 -0.08 ± 0.25
  0.17 ± 0.3 
  0.19 ± 0.25
  -0.0 ± 0.28
 -0.11 ± 0.26
 -0.04 ± 0.24
  0.11 ± 0.26

```
