Created
February 5, 2014 09:37
-
-
Save taichi/8820141 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"crypto/rand" | |
"strings" | |
) | |
func FixSeed(seed string, fn func()) func() { | |
return func() { | |
orig := rand.Reader | |
rand.Reader = strings.NewReader(seed) // fix seed | |
defer func() { | |
rand.Reader = orig | |
}() | |
fn() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment