func (s *FullJitterStrategy) Calculate(attempt int) time.Duration {
	s.rngOnce.Do(func() {
		if s.rng != nil {
			return
		}
		s.rng = rand.New(rand.NewSource(time.Now().UnixNano()))
	})
	backoffDuration := s.cfg.BackoffMultiplier *
		time.Duration(math.Pow(2, float64(attempt)))
	return time.Duration(s.rng.Intn(int(backoffDuration)))
}
Calculate returns a random duration of time [0, 2 ^ attempt]
package nsq
import (
	"crypto/tls"
	"crypto/x509"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"math"
	"math/rand"
	"net"
	"os"
	"reflect"
	"strconv"
	"strings"
	"sync"
	"time"
	"unsafe"
)
type configHandler interface {
	HandlesOption(c *Config, option string) bool
	Set(c *Config, option string, value interface{}) error
	Validate(c *Config) error
}
type defaultsHandler interface {
	SetDefaults(c *Config) error
}
type BackoffStrategy interface {
	Calculate(attempt int) time.Duration
}
type ExponentialStrategy struct {
	cfg *Config
}
func (s *ExponentialStrategy) Calculate(attempt int) time.Duration {
	backoffDuration := s.cfg.BackoffMultiplier *
		time.Duration(math.Pow(2, float64(attempt)))
	return backoffDuration
}
func (s *ExponentialStrategy) setConfig(cfg *Config) {
	s.cfg = cfg
}
type FullJitterStrategy struct {
	cfg *Config
	rngOnce sync.Once
	rng     *rand.Rand
}