Example of Monte Carlo simulation in Scala