github.com/prysmaticlabs/prysm@v1.4.4/tools/analyzers/cryptorand/testdata/custom_import.go (about)

     1  package testdata
     2  
     3  import (
     4  	foobar "math/rand"
     5  	mathRand "math/rand"
     6  	"time"
     7  )
     8  
     9  // UseRandNewCustomImport --
    10  func UseRandNewCustomImport() {
    11  	source := mathRand.NewSource(time.Now().UnixNano()) // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    12  	randGenerator := mathRand.New(source)               // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    13  	start := uint64(randGenerator.Intn(32))
    14  	_ = start
    15  
    16  	source = mathRand.NewSource(time.Now().UnixNano()) // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    17  	randGenerator = mathRand.New(source)               // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    18  }
    19  
    20  // UseWithoutSeeCustomImport --
    21  func UseWithoutSeeCustomImport() {
    22  	assignedIndex := mathRand.Intn(128) // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    23  	_ = assignedIndex
    24  	foobar.Shuffle(10, func(i, j int) { // want "crypto-secure RNGs are required, use CSPRNG or PRNG defined in github.com/prysmaticlabs/prysm/shared/rand"
    25  
    26  	})
    27  }