Skip to content

Instantly share code, notes, and snippets.

@tsloughter
Last active December 25, 2015 05:09
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 tsloughter/6922490 to your computer and use it in GitHub Desktop.
Save tsloughter/6922490 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
var i [5]int
i[0] = 1
i[1] = 2
i[2] = 3
i[3] = 4
i[4] = 5
fmt.Println(rand.Intn(5))
fmt.Println(i[rand.Intn(len(i))])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment