func randomInt(max *big.Int) (int, error) { rand, err := rand.Int(rand.Reader, max) if err != nil { return 0, err } return int(rand.Int64()), nil }
func newRandomInt(max *big.Int) int { rand, err := rand.Int(rand.Reader, max) if err != nil { // Fallback to pseudo-random return pseudoRand.Intn(int(max.Int64())) } return int(rand.Int64()) }