37 lines
698 B
Go
37 lines
698 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"git.staur.ca/stobbsm/tind"
|
|
)
|
|
|
|
var (
|
|
longRuneSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}/';:.>,<`~"
|
|
shortRuneSet = "0123456789"
|
|
)
|
|
|
|
func CollisionChecks() {
|
|
log.Println("Using multiple configurations, test for collisions multiple times")
|
|
|
|
for i := 0; i < 10; i++ {
|
|
log.Printf("Check %d", i)
|
|
log.Printf("Using default values, collision after %d iterations", runCheck(tind.Gen().Config()))
|
|
}
|
|
|
|
|
|
}
|
|
|
|
func runCheck(tconfig *tind.Config) uint64 {
|
|
var i uint64
|
|
tmap := make(map[string]struct{})
|
|
for {
|
|
i++
|
|
t := tconfig.Gen()
|
|
if _, ok := tmap[t.String()]; ok {
|
|
return i
|
|
}
|
|
tmap[t.String()] = struct{}{}
|
|
}
|
|
}
|