Skip to content

Instantly share code, notes, and snippets.

@osuushi
osuushi / pi.js
Last active December 14, 2015 03:38 — forked from peterc/pi.js
var points_total = 0;
var points_inside = 0;
var x, y, i;
while(true) {
for(i = 0; i < 10000; i++) {
x = Math.random();
y = Math.random();
points_inside += 2 + ~(x*x + y*y);
}
points_total += i;