mirror of
https://github.com/onyx-and-iris/lottery-cli.git
synced 2026-08-17 00:34:25 +00:00
add --kind flag, it allows you to configure the lottery kind directly, skipping the selection prompt
update the README with more examples.
This commit is contained in:
4
util.go
4
util.go
@@ -8,8 +8,8 @@ import (
|
||||
// drawUnique returns count unique numbers in the range [1, max].
|
||||
// It uses the rand.Perm function to generate a random permutation of numbers and selects the first count numbers from it.
|
||||
// The result is sorted before being returned.
|
||||
func drawUnique(count, max int) []int {
|
||||
perm := rand.Perm(max)
|
||||
func drawUnique(count, maxNum int) []int {
|
||||
perm := rand.Perm(maxNum)
|
||||
result := make([]int, count)
|
||||
for i := range result {
|
||||
result[i] = perm[i] + 1
|
||||
|
||||
Reference in New Issue
Block a user