mirror of
https://github.com/jimeh/rands.git
synced 2026-02-19 03:16:39 +00:00
Upgrade to Go 1.17 and golangci-lint to 1.64, and fix the linting issues that were found. Also upgrade CI workflow actions to latest versions, and setup a test matrix for relevant Go versions. BREAKING CHANGE: Minimum Go version changed from 1.15 to 1.17.
24 lines
377 B
Go
24 lines
377 B
Go
package randsmust
|
|
|
|
import "github.com/jimeh/rands"
|
|
|
|
// Int generates a random int ranging between 0 and nMax.
|
|
func Int(nMax int) int {
|
|
r, err := rands.Int(nMax)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return r
|
|
}
|
|
|
|
// Int64 generates a random int64 ranging between 0 and nMax.
|
|
func Int64(nMax int64) int64 {
|
|
r, err := rands.Int64(nMax)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return r
|
|
}
|