Last active
July 22, 2017 21:14
-
-
Save igorzakhar/f689952f2d989309c2efef5413cdd2b7 to your computer and use it in GitHub Desktop.
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
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