1package main23import (4 "fmt"5 "math/big"6 "math/rand"7)89func simulate(one, two float64) bool {10 var hi float64 = 1.011 var lo float64 = 0.012 var bound float64 = (hi + lo) / 21314 oneGreater := one >= bound15 twoGreater := two >= bound1617 for oneGreater == twoGreater {18 if oneGreater {19 lo = bound20 bound = (hi + lo) / 221 } else {22 hi = bound23 bound = (hi + lo) / 224 }2526 oneGreater = one >= bound2728 if oneGreater != twoGreater {29 break30 }3132 twoGreater = two >= bound3334 if oneGreater != twoGreater {35 break36 }37 }3839 retval := oneGreater && one > two || twoGreater && two > one40 //fmt.Println(one, two, oneGreater, twoGreater, retval)4142 return retval43}4445func main() {46 var total int64 = 047 var correct int64 = 048 for {49 total++50 if simulate(rand.Float64(), rand.Float64()) {51 correct++52 }5354 if total > 0 && total%10000 == 0 {55 correct := big.NewRat(correct, total)56 n, _ := correct.Float64()57 fmt.Println(n)58 }59 }60}