sample

sample keyword

The keyword sample represents an aggregation process within a montecarlo block. The aggregation is relative to the iterations of the montecarlo block itself.

montecarlo 1000 with
  x = random.uniform(-1, 1)
  y = random.uniform(-1, 1)
  inCircle = x^2 + y^2 < 1
  sample approxPi = avg(if inCircle then 4 else 0)
show scalar "π approximation" with approxPi

At this point, avg() is the sole aggregator supported by sample.