DynamicModule[{numPoints=10000,randomPoints={},pointsInQuarterCircle={},circlePi,count=0,animating=False},Column[{Row[{Button["Start Animation",If[!animating,count=0;randomPoints={};pointsInQuarterCircle={};
animating=True;];],Button["Stop Animation",animating=False;]
}],Dynamic[Refresh[If[animating&&count<numPoints,count++;
AppendTo[randomPoints,{RandomReal[{0,1}],RandomReal[{0,1}]}];
If[(randomPoints[[-1,1]]^2+randomPoints[[-1,2]]^2<=1),AppendTo[pointsInQuarterCircle,randomPoints[[-1]]]];
circlePi=(Length[pointsInQuarterCircle]/count)*4;];
Graphics[{Thick,Circle[{0,0},1,{0,Pi/2}],Line[{{0,0},{1,0}}],Line[{{0,0},{0,1}}],Line[{{1,0},{1,1}}],Line[{{0,1},{1,1}}],Red,PointSize[Small],Point[randomPoints],Blue,PointSize[Medium],Point[pointsInQuarterCircle]},Axes->True,AxesOrigin->{0,0},PlotRange->{{-0.1,1.1},{-0.1,1.1}},AspectRatio->1],UpdateInterval->0.01,TrackedSymbols:>{count,animating}]],Dynamic[Column[{"点の総数: "<>ToString[count],

"四半円の中に入った点の数: "<>ToString[Length[pointsInQuarterCircle]],"πの近似値: "<>ToString[N[circlePi]]}]]}]]