Skip to content

Instantly share code, notes, and snippets.

@clozed2u
Created Feb 6, 2020
Embed
What would you like to do?
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