samedi 12 février 2022

what is the value range for crypto.rand.read at golang?

At Goalng, what is maximum value we can get from function crpto.rand.read? here is the code

 
import (
    "crypto/rand"
    "fmt"
)
 
func main() {
    c := 10
    b := make([]byte, c)
    rand.Read(b)
 
    fmt.Println(b) 
} 

I run a lot of times, and I find the maximum value always smaller than 256. I guess this generated value range is from 1 - 256? im not sure im right or not. any infomation about it?




Aucun commentaire:

Enregistrer un commentaire