package gorandomimport ()// String returns random string of given length.//// Parameters://// numbers: Include numbers to random string// letters: Include english letters to random string// specials: Include special characters to random string// length: Random string lengthfunc (, , bool, int) (string, error) {var []stringvarstringif == 0 || < 0 {return"", errors.New("string length must be greater than zero") }if !( || || ) {return"", errors.New("at least one of letters, special characters or numbers must be included") } = internal.GetCharset(, , ) // Get charsetrand.Seed(time.Now().UnixNano()) // Set start point randomlyfor := 0; < ; += 1 { += [rand.Intn(len())] // Generate random string }return , nil}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.