Skip to content

Instantly share code, notes, and snippets.

@souvikhaldar
Created October 25, 2018 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save souvikhaldar/ede021b4955dfd132f20e577ca00fff9 to your computer and use it in GitHub Desktop.
Save souvikhaldar/ede021b4955dfd132f20e577ca00fff9 to your computer and use it in GitHub Desktop.
// getRandNum returns a random number of size four
func getRandNum() (string, error) {
nBig, e := rand.Int(rand.Reader, big.NewInt(8999))
if e != nil {
return "", e
}
return strconv.FormatInt(nBig.Int64()+1000, 10), nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment