Skip to content

Instantly share code, notes, and snippets.

@elcuervo
Created May 28, 2013 14:30
Show Gist options
  • Save elcuervo/5663164 to your computer and use it in GitHub Desktop.
Save elcuervo/5663164 to your computer and use it in GitHub Desktop.
Random int in range
package main
import(
"fmt"
"math/rand"
"time"
)
func random(min, max int) int {
rand.Seed(time.Now().Unix())
return rand.Intn(max - min) + min
}
func main() {
ranged := random(1, 59)
fmt.Println(ranged)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment