Skip to content

Instantly share code, notes, and snippets.

@peko
Created June 30, 2015 22:11
Show Gist options
  • Save peko/2e1825af12a579fd9310 to your computer and use it in GitHub Desktop.
Save peko/2e1825af12a579fd9310 to your computer and use it in GitHub Desktop.
200M Random words
package main
import (
"crypto/rand"
"fmt"
// "strconv"
)
const total = 200000000
func generateRandomKey() string {
rb := make([]byte, 10)
rand.Read(rb)
for i, _ := range rb {
rb[i] = (rb[i]%23 + 65)
}
return fmt.Sprintf("%s", rb)
}
func main() {
codes := map[string]bool{}
for i := 0; i < total; i++ {
codes[generateRandomKey()] = true
}
for k, _ := range codes {
fmt.Println(k)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment