# Random Package random implements some basic functions to generate random int and string.
## Source: [https://github.com/duke-git/lancet/blob/v1/random/random.go](https://github.com/duke-git/lancet/blob/v1/random/random.go)
## Usage: ```go import ( "github.com/duke-git/lancet/random" ) ```
## Index - [RandBytes](#RandBytes) - [RandInt](#RandInt) - [RandString](#RandString) - [UUIdV4](#UUIdV4)
## Documentation ### RandBytes

Generate random byte slice.

Signature: ```go func RandBytes(length int) []byte ``` Example: ```go package main import ( "fmt" "github.com/duke-git/lancet/random" ) func main() { randBytes := random.RandBytes(4) fmt.Println(randBytes) } ``` ### RandInt

Generate random int between min and max, may contain min, not max.

Signature: ```go func RandInt(min, max int) int ``` Example: ```go package main import ( "fmt" "github.com/duke-git/lancet/random" ) func main() { rInt := random.RandInt(1, 10) fmt.Println(rInt) } ``` ### RandInt

Generate random given length string.

Signature: ```go func RandString(length int) string ``` Example: ```go package main import ( "fmt" "github.com/duke-git/lancet/random" ) func main() { randStr := random.RandString(6) fmt.Println(randStr) } ``` ### UUIdV4

Generate a random UUID of version 4 according to RFC 4122.

Signature: ```go func UUIdV4() (string, error) ``` Example: ```go package main import ( "fmt" "github.com/duke-git/lancet/random" ) func main() { uuid, err := random.UUIdV4() if err != nil { return } fmt.Println(uuid) } ```