RandomString generates a random string of the specified length
(length int)
| 226 | |
| 227 | // RandomString generates a random string of the specified length |
| 228 | func RandomString(length int) string { |
| 229 | const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
| 230 | result := make([]byte, length) |
| 231 | for i := range result { |
| 232 | n, err := rand.Int(rand.Reader, big.NewInt(int64(len(charset)))) |
| 233 | if err != nil { |
| 234 | Print(err.Error(), Red) |
| 235 | return "99999999" |
| 236 | } |
| 237 | result[i] = charset[n.Int64()] |
| 238 | } |
| 239 | return string(result) |
| 240 | } |
| 241 | |
| 242 | func removeParam(rawURL string, paramToRemove string) (string, string, error) { |
| 243 | // Parse the URL |