Skip to content

Instantly share code, notes, and snippets.

@igorzakhar
Last active July 22, 2017 21:14
Show Gist options
  • Save igorzakhar/f689952f2d989309c2efef5413cdd2b7 to your computer and use it in GitHub Desktop.
Save igorzakhar/f689952f2d989309c2efef5413cdd2b7 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
numbers := make([]int, 5)
for i := 0; i < 5; i++ {
numbers[i] = random(1, 6)
}
fmt.Println(numbers)
}
func random(min, max int) int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(max-min) + min
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment