Fix docs.
This commit is contained in:
parent
4bfaae0c47
commit
5abb82120b
12
uniuri.go
12
uniuri.go
@ -28,20 +28,20 @@ const (
|
|||||||
// Standard characters allowed in uniuri string.
|
// Standard characters allowed in uniuri string.
|
||||||
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
|
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
|
||||||
|
|
||||||
// New returns a new random string with the standard length and standard
|
// New returns a new random string of the standard length, consisting of
|
||||||
// characters.
|
// standard characters.
|
||||||
func New() string {
|
func New() string {
|
||||||
return NewLenChars(StdLen, StdChars)
|
return NewLenChars(StdLen, StdChars)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLen returns a new random string with the provided length and standard
|
// NewLen returns a new random string of the provided length, consisting of
|
||||||
// characters.
|
// standard characters.
|
||||||
func NewLen(length int) string {
|
func NewLen(length int) string {
|
||||||
return NewLenChars(length, StdChars)
|
return NewLenChars(length, StdChars)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLenChars returns a new random string with the provided length and byte
|
// NewLenChars returns a new random string of the provided length, consisting
|
||||||
// slice of allowed characters (maximum 256).
|
// of the provided byte slice of allowed characters (maximum 256).
|
||||||
func NewLenChars(length int, chars []byte) string {
|
func NewLenChars(length int, chars []byte) string {
|
||||||
b := make([]byte, length)
|
b := make([]byte, length)
|
||||||
if _, err := rand.Reader.Read(b); err != nil {
|
if _, err := rand.Reader.Read(b); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user