Source File
random.go
Belonging Package
github.com/gookit/goutil/mathutil
package mathutilimport ()// RandomInt return a random int at the [min, max)//// Usage://// RandomInt(10, 99)// RandomInt(100, 999)// RandomInt(1000, 9999)func (, int) int {:= rand.New(rand.NewSource(time.Now().UnixNano()))return + .Intn(-)}// RandInt alias of RandomInt()func (, int) int { return RandomInt(, ) }// RandIntWithSeed alias of RandomIntWithSeed()func (, int, int64) int {return RandomIntWithSeed(, , )}// RandomIntWithSeed return a random int at the [min, max)//// Usage://// seed := time.Now().UnixNano()// RandomIntWithSeed(1000, 9999, seed)func (, int, int64) int {:= rand.New(rand.NewSource())return + .Intn(-)}
![]() |
The pages are generated with Golds v0.8.4. (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |