π 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())
}