dtp/importfunc/generate_user_id_map.go

34 lines
618 B
Go

package importfunc
import (
"bufio"
"fmt"
"math/rand"
"os"
)
func GenerateUserIdMap() {
outfile, err := os.OpenFile("/Users/Caeru/dataprep/file/user_id_map.txt", os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
fmt.Printf("Open File Err : %v", err)
}
defer outfile.Close()
writer := bufio.NewWriter(outfile)
list := make([]int64, 0)
for i := int64(1000000); i < 100000000; i++ {
list = append(list, i)
}
rand.Shuffle(99000000, func(i, j int) {
list[i], list[j] = list[j], list[i]
})
for i := range list {
outfile.WriteString(fmt.Sprintf("%v:%v\n", 1000000+i, list[i]))
}
writer.Flush()
}