-
-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade to math/rand/v2 (#483)
* feat: upgrade to math/rand/v2 * lint: silent warning
- Loading branch information
Showing
6 changed files
with
38 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build !go1.22 | ||
|
||
package rand | ||
|
||
import "math/rand" | ||
|
||
func Shuffle(n int, swap func(i, j int)) { | ||
rand.Shuffle(n, swap) | ||
} | ||
|
||
func IntN(n int) int { | ||
// bearer:disable go_gosec_crypto_weak_random | ||
return rand.Intn(n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build go1.22 | ||
|
||
package rand | ||
|
||
import "math/rand/v2" | ||
|
||
func Shuffle(n int, swap func(i, j int)) { | ||
rand.Shuffle(n, swap) | ||
} | ||
|
||
func IntN(n int) int { | ||
return rand.IntN(n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters