There was a request from the list of lists to make ** x people **, so I wrote it in go language.
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
list := [...]string{"mano", "hiori", "meguru",
"kogane", "mmm", "mitsumine", "sakuya", "kiriko",
"kaho", "choko", "jyuri", "rinze", "natsuha",
"amana", "tenka", "chiyuki",
"asahi", "huyu", "mei",
"toru", "higuchi", "pya", "hinana"}
//How to divide
parse := 5
//A slice that holds the random numbers that appear
var slice []int
rand.Seed(time.Now().UnixNano())
for i := 1; i < len(list)+1; i++ {
var r int
//Random number generation
for {
r = rand.Intn(len(list))
if !contains(slice, r) {
slice = append(slice, r)
break
}
}
fmt.Printf("%v ", list[r])
if i%parse == 0 {
fmt.Println("")
}
}
}
func contains(s []int, e int) bool {
for _, v := range s {
if e == v {
return true
}
}
return false
}
huyu amana kaho asahi toru
kogane kiriko mano rinze meguru
hiori mitsumine sakuya higuchi jyuri
natsuha tenka chiyuki pya choko
mei mmm hinana
https://gawawa124.hatenablog.com/entry/2015/04/08/193237
https://takeshiyako.blogspot.com/2015/10/go-lang-rand.html
Recommended Posts