(n int)
| 16 | ) |
| 17 | |
| 18 | func randIntn(n int) int { |
| 19 | max := big.NewInt(int64(n)) |
| 20 | res, err := rand.Int(randReader, max) |
| 21 | if err != nil { |
| 22 | panic("random source is not available") |
| 23 | } |
| 24 | return int(res.Int64()) |
| 25 | } |
| 26 | |
| 27 | // GenerateNotExistingToken receives a token generation func and a func to check whether the token exists, returns a unique token. |
| 28 | func GenerateNotExistingToken(generateToken func() string, tokenExists func(token string) bool) string { |
no outgoing calls
searching dependent graphs…