Skip to content

Instantly share code, notes, and snippets.

@praswicaksono
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save praswicaksono/0d563923d074dca20604 to your computer and use it in GitHub Desktop.

Select an option

Save praswicaksono/0d563923d074dca20604 to your computer and use it in GitHub Desktop.
;)
package main
import (
"fmt"
"math/rand"
"time"
)
func random(min, max int) int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(max-min) + min
}
func main() {
for {
a := float32(random(1, 9))
b := float32(random(1, 9))
c := float32(random(1, 9))
d := float32(random(1, 9))
e := float32(random(1, 9))
f := float32(random(1, 9))
g := float32(random(1, 9))
h := float32(random(1, 9))
i := float32(random(1, 9))
result := float32(a + (13 * b / c) + d + (12 * e) - f - 11 + (g * h / i) - 10)
if result == float32(66.00000000000000000) {
fmt.Printf("%.0f + (13 * %.0f / %.0f) + %.0f + (12 * %.0f) - %.0f - 11 + (%.0f * %.0f / %.0f) - 10", a, b, c, d, e, f, g, h, i)
fmt.Println()
return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment