prysm-pulse/tools/analyzers/cryptorand/testdata/custom_import.go
Victor Farazdagi 78465e2549
QSP-6: Enforces crypto-secure PRNGs (#6401)
* adds cryptorand analyzer

* better naming

* rely on suffix

* sync/pending_* use crypto/rand

* define shared/rand

* updates fetcher

* fixes rand issue in sync package

* gofmt

* shared/rand: more docs + add exclusion nogo_config.json

* updates validator/assignments

* updates comment

* fixes remaning cases

* re-arranges comments

* fixes tests

* renames in shared/rand API

* adds simple no-panic test

* gazelle

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-06-26 09:58:47 -05:00

24 lines
451 B
Go

package testdata
import (
foobar "math/rand"
mathRand "math/rand"
"time"
)
func UseRandNewCustomImport() {
randGenerator := mathRand.New(mathRand.NewSource(time.Now().UnixNano()))
start := uint64(randGenerator.Intn(32))
_ = start
randGenerator = mathRand.New(mathRand.NewSource(time.Now().UnixNano()))
}
func UseWithoutSeeCustomImportd() {
assignedIndex := mathRand.Intn(128)
_ = assignedIndex
foobar.Shuffle(10, func(i, j int) {
})
}