forked from TrueCloudLab/frostfs-node
[#851] util/rand: use single random source
It is much more convenient to skip source creation. Also fix some bugs: 1. `cryptoSource.Int63()` now returns number in [0, 1<<63) as required by `rand.Source` interface. 2. Replace `cryptoSource.Uint63()` with `cryptoSource.Uint64` to allow generate uint64 numbers directly (see rand.Source64 docs). Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
c35cdb3684
commit
5828f43e52
8 changed files with 56 additions and 66 deletions
|
@ -69,10 +69,9 @@ func (ap *Processor) processStartAudit(epoch uint64) {
|
|||
}
|
||||
|
||||
n := nodes.Flatten()
|
||||
crand := rand.New() // math/rand with cryptographic source
|
||||
|
||||
// shuffle nodes to ask a random one
|
||||
crand.Shuffle(len(n), func(i, j int) {
|
||||
rand.Shuffle(len(n), func(i, j int) {
|
||||
n[i], n[j] = n[j], n[i]
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue