I converted this from VB6 into Javascript:

Code:
  function CalculatePi() // Calculates Pi by counting all the points around a circle making it easier and randomizing it.
	 {
	  var TOTAL_POINTS = new Number(1000000); //  points in pi (3.14159)
		var x = new Number();
		var y = new Number();
		var points_in_circle = new Number();
		var i = new Number();
			  for (i;i<=TOTAL_POINTS;i++) // for i = 0 to 1000000 increasing by 1 increment every loop
				 {
				  x = Math.random() * 1; // random x between 0 and 1
					y = Math.random() * 1; // random y between 0 and 1
	          if (x * x + y * y < 1) // if both randomized to 0
						 {
						  points_in_circle = points_in_circle + 1; // increase points_in_circle
						 }
				 }
				return 4 * points_in_circle / TOTAL_POINTS; // return answer to user
	 }