Created
September 23, 2015 20:55
-
-
Save gambrell/99c1572f05eb15376b06 to your computer and use it in GitHub Desktop.
golang randomInt
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
func randomInt(min int, max int) int { | |
// min and max inclusive | |
// assumes Seed has been set once for the program | |
// use something like rand.Seed(time.Now().UTC().UnixNano()) | |
return min + rand.Intn(max-min+1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment