String returns a random string of length n, it uses the characters of base64.URLEncoding.
(n int)
| 43 | |
| 44 | // String returns a random string of length n, it uses the characters of base64.URLEncoding. |
| 45 | func String(n int) string { |
| 46 | b := Bytes(n * 6 / 8) |
| 47 | return base64.RawURLEncoding.EncodeToString(b) |
| 48 | } |
| 49 | |
| 50 | // Jitter returns a random number around d where p is the maximum percentage of change applied to d. |
| 51 | // With d=100 and p=0.1, the duration returned will be in [90,110]. |