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() { | |
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