code: func randomOffset(n int) int {
  	if n == 0 {
  		return 0
  	}
  
  	val, err := rand.Int(rand.Reader, big.NewInt(int64(n)))
  	if err != nil {
  		logrus.Errorf("Failed to get a random offset: %v", err)
  		return 0
  	}
  
  	return int(val.Int64())
  }
docs: // Returns a random offset between 0 and n