internal/detrand: support disabling detrand

Since detrand is an internal package, we can safely provide a function
that can be called to disable its functionality for testing purposes.

Change-Id: I26383e12a5832eb5af01952898a4c73f627d7aa5
Reviewed-on: https://go-review.googlesource.com/c/151678
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/detrand/rand.go b/internal/detrand/rand.go
index c702f8f..f5d9eeb 100644
--- a/internal/detrand/rand.go
+++ b/internal/detrand/rand.go
@@ -15,9 +15,15 @@
 	"os"
 )
 
+// Disable disables detrand such that all functions returns the zero value.
+// This function is not concurrent-safe and must be called during program init.
+func Disable() {
+	binHash = 0
+}
+
 // Bool returns a deterministically random boolean.
 func Bool() bool {
-	return binHash%2 == 0
+	return binHash%2 == 1
 }
 
 // Intn returns a deterministically random integer within [0,n).