forked from TrueCloudLab/frostfs-api-go
[#401] internal: Place randomization code in random package
Also replace seeding into `init` function. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
02e962f727
commit
c82dcf7e16
4 changed files with 22 additions and 19 deletions
15
internal/random/rand.go
Normal file
15
internal/random/rand.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package random
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// Uint32 returns random uint32 value [0, max).
|
||||
func Uint32(max uint32) uint32 {
|
||||
return rand.Uint32() % max
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue