Created
June 30, 2015 22:11
-
-
Save peko/2e1825af12a579fd9310 to your computer and use it in GitHub Desktop.
200M Random words
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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