Skip to content

Instantly share code, notes, and snippets.

@bylatt
Created February 6, 2020 05:37
Show Gist options
  • Save bylatt/f53a05eb8f674a03ee24718cdee5d3cc to your computer and use it in GitHub Desktop.
Save bylatt/f53a05eb8f674a03ee24718cdee5d3cc to your computer and use it in GitHub Desktop.
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]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment