Created
June 22, 2021 23:35
-
-
Save namp10010/052185d978ba2520464f07dc36de87a0 to your computer and use it in GitHub Desktop.
golang cryto/rand random number example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// https://play.golang.org/p/3DeMCc248KQ | |
import ( | |
"crypto/rand" | |
"encoding/binary" | |
"fmt" | |
) | |
func main() { | |
var v uint64 | |
binary.Read(rand.Reader, binary.BigEndian, &v) | |
fmt.Println(v) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment