# Monte Carlo Simulator # Determine value of pi # 21010513 tosses = 1000 in_c = 0 i = 0 for i = 1 to tosses x = rand y = rand x2 = x * x y2 = y * y xy = x2 + y2 d_xy = sqr(xy) if d_xy <= 1 then in_c += 1 endif next i print float(4*in_c/tosses)