Skip to content

πŸ”– Random ​

go
import (
	"github.com/thuongtruong109/gouse"
)

1. Random number ​

Description: Return a random number between min and max
Input params: (min, max int)

go
func RandomNumber() {
	gouse.Println("Random number [1, 10): ", gouse.RandNum(1, 100))
}

2. Random i d ​

Description: Return a random id (string) with current timestamp

go
func RandomID() {
	gouse.Println("Generate random ID: ", gouse.RandID())
}

3. Random string ​

Description: Return a random string with n characters length
Input params: (length int)

go
func RandomString() {
	gouse.Println(gouse.RandStr(10))
}

4. Random digit ​

Description: Return a random digit number with n characters length
Input params: (length int)

go
func RandomDigit() {
	gouse.Println(gouse.RandDigit(10))
}

5. Random u u i d ​

Description: Return a random UUID (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

go
func RandomUUID() {
	gouse.Println(gouse.UUID())
}

Released under the MIT License.