Thank you. On Wednesday, 26 February 2020 00:16:29 UTC+5:30, burak serdar wrote: > > On Tue, Feb 25, 2020 at 11:42 AM Anjana Prabhakar > <prabhak...@gmail.com <javascript:>> wrote: > > > > Hi All, > > > > I am trying to generate a random integer using the below code snippet: > > package ABC > > import ( > > ***** > > "math/rand" > > ) > > func execBlock( > > logger log.Logger,) { > > var validTxs, invalidTxs, unchkdTxs = 0, 0, 0 > > > > txIndex := 0 > > proxyCb := func(req *xxx, res *yyy) { > > if r, ok := res.Value.(*yyyy); ok { > > txRes := r.DeliverTx > > // code for random integer begin > > s1 := rand.NewSource(time.Now().UnixNano()) > > r1 := rand.New(s1) > > toCheck := r1.randIntn(100) // getting error for this line > > if toCheck <= 65{ > > *********** > > }else { > > ********* > > }// end > > } > > } > > } > > > > I get the error as r1.randIntn undefined (type *math/rand.Rand has no > field or method randIntn). Please help. > > It doesn't have randIntn, it has Intn, so use r1.Intn(100) > > > > > Thanks, > > Anjana > > > > -- > > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to golan...@googlegroups.com <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/5f0fc1e1-3554-4d2d-b7e4-0fbc196e1b53%40googlegroups.com. > > >
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4ad14437-126f-43ed-bec4-7c9742d2d4b2%40googlegroups.com.