Misunderstanding Allocs for Monte Carlo summation

rand(Float64, n_x) is allocating an array of n_x elements. You probably want res .+= rand.(Float64)

2 Likes