31 lines
476 B
Go
31 lines
476 B
Go
|
package pairs
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"math/rand"
|
||
|
)
|
||
|
|
||
|
func MakePairs() []string {
|
||
|
var pairs []string
|
||
|
for i := 1; i <= 1000; i++ {
|
||
|
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)
|
||
|
}
|