func newCentralizedStrategy()

in strategy/sampling/centralized.go [96:125]


func newCentralizedStrategy(fb *LocalizedStrategy) (*CentralizedStrategy, error) {
	// Generate clientID
	var r [12]byte

	_, err := crypto.Read(r[:])
	if err != nil {
		return nil, err
	}

	id := fmt.Sprintf("%02x", r)

	clock := &utils.DefaultClock{}
	rand := &utils.DefaultRand{}

	m := &CentralizedManifest{
		Rules: []*CentralizedRule{},
		Index: map[string]*CentralizedRule{},
		clock: clock,
	}

	ss := &CentralizedStrategy{
		manifest: m,
		fallback: fb,
		clientID: id,
		clock:    clock,
		rand:     rand,
	}

	return ss, nil
}