Dim total, inside As Long
Dim limit As Long = DateTime.Now + DateTime.TicksPerSecond * 60
Do While DateTime.Now < limit
Dim x As Double = Rnd(0,0x7FFFFFFF)/ 0x7FFFFFFE
Dim y As Double = Rnd(0,0x7FFFFFFF)/ 0x7FFFFFFE
If x * x + y * y <= 1 Then inside = inside + 1
total = total + 1
If total mod 1000000 = 0 Then Log($"PI = ${4 * inside / total}"$)
Loop
Log($"PI = ${4 * inside / total}"$)
Log($"Constant value = ${cPI}"$)
Log($"Total: ${total}"$)