package main
import (
"crypto/rand"
"fmt"
"math/big"
)
func main() {
//var i1 int
//i1 = 9223372036854775807
//fmt.Printf("%T, %d\n", i1, i1)
//var i2 int8
//i2 = 127
//fmt.Printf("%T, %d\n", i2, i2)
// 生成大整数
max := new(big.Int).Lsh(big.NewInt(1), 128)
fmt.Println(max)
// 生成大整数随机数
serialNumber, _ := rand.Int(rand.Reader, max)
fmt.Println(serialNumber)
}
|
请发表评论