Hi I am working on the pi example in JuliaBox. When I am generating random numbers the only way I do not get 0 as the value of pi is if I multiply by rand() (as it did in the solution to the exercise). It looks like multiplying rand() makes x and y decimals. I was wondering how multiplying rand() was used or what it specifically does?
Acircle = 0
for i in 1:N x, y = rand([-1, 1])*rand(), rand([-1, 1])*rand() dist = sqrt(x^2 + y^2) dist < r ? Acircle += 1 : Acircle += 0 end return 4*(Acircle/N)
N = 10000
r = 1