MCPcopy
hub / github.com/projectdiscovery/subfinder / PickRandom

Function PickRandom

pkg/subscraping/utils.go:12–20  ·  view source on GitHub ↗
(v []T, sourceName string)

Source from the content-addressed store, hash-verified

10const MultipleKeyPartsLength = 2
11
12func PickRandom[T any](v []T, sourceName string) T {
13 var result T
14 length := len(v)
15 if length == 0 {
16 gologger.Debug().Msgf("Cannot use the %s source because there was no API key/secret defined for it.", sourceName)
17 return result
18 }
19 return v[rand.Intn(length)]
20}
21
22func CreateApiKeys[T any](keys []string, provider func(k, v string) T) []T {
23 var result []T

Callers 15

fetchMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected