-
-
Save bylatt/f53a05eb8f674a03ee24718cdee5d3cc to your computer and use it in GitHub Desktop.
Revisions
-
bylatt created this gist
Feb 6, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ package main import ( "fmt" "math/rand" "time" ) func main() { candidates := []string{ "Lattapon Yodsuwan", "Atcha Prachayapron", "Tanakorn Suanprang", "Chatchalerm charoenvichienchai", } for i := 0; i < len(candidates); i = i + 1 { s1 := rand.NewSource(time.Now().UnixNano()) r1 := rand.New(s1) randNum := r1.Intn(len(candidates)) // fmt.Println(candidates[randNum]) fmt.Println("Lattapon Yodsuwan") candidates[randNum] = candidates[len(candidates)-1] candidates = candidates[:len(candidates)-1] } }