Debian Codegraph @

staticcheck/sa4030/testdata/go1.0/CheckIneffectiveRandInt/CheckIneffectiveRandInt.go

raw
1 package pkg
2
3 import "math/rand"
4
5 func fn() {
6 type T struct {
7 rng rand.Rand
8 }
9
10 _ = rand.Intn(1) //@ diag(re`rand\.Intn\(n\) generates.+rand\.Intn\(1\) therefore`)
11 _ = rand.Int63n(1) //@ diag(re`rand\.Int63n\(n\) generates.+rand\.Int63n\(1\) therefore`)
12 var t T
13 _ = t.rng.Intn(1) //@ diag(re`\(\*math/rand\.Rand\)\.Intn\(n\) generates.+t\.rng\.Intn\(1\) therefore`)
14
15 _ = rand.Intn(2)
16 }