Skip to content

Instantly share code, notes, and snippets.

@gambrell
Created September 23, 2015 20:55
Show Gist options
  • Save gambrell/99c1572f05eb15376b06 to your computer and use it in GitHub Desktop.
Save gambrell/99c1572f05eb15376b06 to your computer and use it in GitHub Desktop.
golang randomInt
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