2023-12-30 21:35:09 +00:00
|
|
|
package pairs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"math/rand"
|
|
|
|
)
|
|
|
|
|
2023-12-31 17:18:29 +00:00
|
|
|
func MakePairs(n int) []string {
|
2023-12-30 21:35:09 +00:00
|
|
|
var pairs []string
|
2023-12-31 17:18:29 +00:00
|
|
|
for i := 1; i <= n; i++ {
|
2023-12-30 21:35:09 +00:00
|
|
|
pairs = append(pairs, makeKey(i) + "," + makeValue())
|
|
|
|
}
|
|
|
|
|
|
|
|
return pairs
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeKey(i int) string {
|
|
|
|
return fmt.Sprintf("%06d", i)
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeValue() string {
|
|
|
|
var letters = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
|
|
|
var length int = len(letters)
|
|
|
|
|
|
|
|
s := make([]rune, 6)
|
|
|
|
for i := range s {
|
|
|
|
s[i] = letters[rand.Intn(length)]
|
|
|
|
}
|
|
|
|
|
|
|
|
return string(s)
|
|
|
|
}
|