// GenerateNameWithSeed generates a Random Name with adjectiveAmount Adjectives, nounAmount Nouns and a random Number with randomNumberPlaces places.
// The Random Generator uses the specified number as a seed.
174752
func GenerateNameWithSeed(adjectiveAmount int, nounAmount int, randomNumberPlaces int, seed int64) (string, error) {
  random = rand.New(rand.NewSource(seed))

  return GenerateName(adjectiveAmount, nounAmount, randomNumberPlaces)
}
921698
func (t *Template) GetAWSGreengrassConnectorDefinitionWithName(name string) (*resources.AWSGreengrassConnectorDefinition, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSGreengrassConnectorDefinition:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSGreengrassConnectorDefinition not found", name)
}
1369018
func SeedMathRand() {
	once.Do(func() {
		n, err := crand.Int(crand.Reader, big.NewInt(math.MaxInt64))
		if err != nil {
			rand.Seed(time.Now().UTC().UnixNano())
			return
		}
		rand.Seed(n.Int64())
		SeededSecurely = true
	})
}
1051822
func GenerateLowerName(randomNameGenerator func() string, names ...string) string {
	name := randomNameGenerator()

	var safe bool
	for !safe {
		safe = true
		for _, nameToBeHigherThan := range names {
			// regenerate name if name is NOT lower
			if !sort.StringsAreSorted([]string{name, nameToBeHigherThan}) {
				name = randomNameGenerator()
				safe = false
				break
			}
		}
	}
	return name
}
732417
func NewName() (*Name, error) {
	n := C.X509_NAME_new()
	if n == nil {
		return nil, errors.New("could not create x509 name")
	}
	name := &Name{name: n}
	runtime.SetFinalizer(name, func(n *Name) {
		C.X509_NAME_free(n.name)
	})
	return name, nil
}
655135
func (lr *LockedRand) Seed(seed int64) {
	lr.lk.Lock()
	lr.r.Seed(seed)
	lr.lk.Unlock()
}
1336866
func Sum128WithSeed(data []byte, seed uint32) (h1 uint64, h2 uint64) {
	d := digest128{h1: uint64(seed), h2: uint64(seed)}
	d.seed = seed
	d.tail = d.bmix(data)
	d.clen = len(data)
	return d.Sum128()
}
401733
func (ung *uniqueNameGenerator) Generate(suggester NameSuggester) (string, error) {
	name := ung.originalName
	if len(name) == 0 {
		var ok bool
		name, ok = suggester.SuggestName()
		if !ok {
			return "", ErrNameRequired
		}
	}
	return ung.ensureValidName(name)
}
865515
func (p Prefixed) Generate() string {
	if p.Len == 0 {
		p.Len = PrefixedDefaultLen
	}

	if len(p.Acceptable) == 0 {
		p.Acceptable = PrefixedDefaultAcceptable
	}

	if p.RandGenerator == nil {
		p.RandGenerator = rand.Reader
	}

	builder := bytes.NewBufferString(p.Prefix)

	max := big.NewInt(int64(len(p.Acceptable)))

	for i := uint8(0); i < p.Len; i++ {
		result, err := rand.Int(p.RandGenerator, max)
		if err != nil {
			panic(err)
		}
		builder.WriteRune(p.Acceptable[result.Int64()])
	}
	return builder.String()
}
1226059
func RandomPolynomial(seed int64) (Pol, error) {
	return DerivePolynomial(rand.New(rand.NewSource(seed)))
}
999138
func generateStorageAccountName(accountNamePrefix string) string {
	uniqueID := strings.Replace(string(uuid.NewUUID()), "-", "", -1)
	accountName := strings.ToLower(accountNamePrefix + uniqueID)
	if len(accountName) > storageAccountNameMaxLength {
		return accountName[:storageAccountNameMaxLength-1]
	}
	return accountName
}
1214366
func randomSource() *rand.Rand {
	bytes := make([]byte, 8)
	seed := time.Now().UnixNano()
	if _, err := crand.Read(bytes); err == nil {
		seed = int64(binary.LittleEndian.Uint64(bytes))
	}

	src := rand.NewSource(seed)
	return rand.New(src)
}
711465
func withNamedPort(portName string, spec labels.Func, gen chain) chain {
	portName = spec(portName)
	if portName == "" {
		return gen
	}
	return func(records ...string) {
		// generate without port-name prefix
		gen(records...)

		// generate with port-name prefix
		for i := range records {
			records[i] = "_" + portName + "." + records[i]
		}
		gen(records...)
	}
}
983123
func WithName(name string) (Named, error) {
	if len(name) > NameTotalLengthMax {
		return nil, ErrNameTooLong
	}

	match := anchoredNameRegexp.FindStringSubmatch(name)
	if match == nil || len(match) != 3 {
		return nil, ErrReferenceInvalidFormat
	}
	return repository{
		domain: match[1],
		path:   match[2],
	}, nil
}
1066158
func SeedString(seed []byte) string {
	if len(seed) != SeedLength {
		return ""
	}

	buf := new(bytes.Buffer)

	// 2 byte Seed Address Prefix
	buf.Write(seedPrefix)

	// 64 byte Seed
	buf.Write(seed)

	// 4 byte Checksum
	check := shad(buf.Bytes())[:4]
	buf.Write(check)

	return base58.Encode(buf.Bytes())
}
377817
func WithName(s string) source.Option {
	return func(o *source.Options) {
		if o.Context == nil {
			o.Context = context.Background()
		}
		o.Context = context.WithValue(o.Context, nameKey{}, s)
	}
}
1027570
func (b *Builder) WithSeedProvider(seedProv account.SeedProvider) *Builder {
	b.settings.SeedProv = seedProv
	return b
}