// we're actually going to use a quarter circle for this example
// Math.random() outputs a number on the interval [0,1) so this makes a point [0,1)x[0,1)
letpoint=[Math.random(),Math.random()];
// if the point is actually within 1 unit of the origin, it's inside the circle
if(l2_norm(point)<=1)inside_circle_count++;
}
return4*inside_circle_count/num_darts;
}
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.