Skip to content

Commit

Permalink
feat: add xrand ChoiceInt
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalvas committed Aug 7, 2023
1 parent 8191b74 commit c8419d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xrand/choice.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xrand

import "math/rand"

func ChoiceInt(list []int) int {
randomIndex := rand.Intn(len(list))
return list[randomIndex]
}

0 comments on commit c8419d0

Please sign in to comment.