MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / repeatRandomStringByRegex

Function repeatRandomStringByRegex

tools/security/random_by_regex.go:102–129  ·  view source on GitHub ↗
(r *syntax.Regexp, sb *strings.Builder, min int, max int)

Source from the content-addressed store, hash-verified

100}
101
102func repeatRandomStringByRegex(r *syntax.Regexp, sb *strings.Builder, min int, max int) error {
103 if max < 0 {
104 max = defaultMaxRepeat
105 }
106
107 if max < min {
108 max = min
109 }
110
111 n := min
112 if max != min {
113 randRange, err := randomNumber(max - min)
114 if err != nil {
115 return err
116 }
117 n += randRange
118 }
119
120 var err error
121 for i := 0; i < n; i++ {
122 err = writeRandomStringByRegex(r, sb)
123 if err != nil {
124 return err
125 }
126 }
127
128 return nil
129}
130
131func randomRuneFromPairs(pairs []rune) (rune, error) {
132 if len(pairs)%2 != 0 {

Callers 1

writeRandomStringByRegexFunction · 0.85

Calls 2

randomNumberFunction · 0.85
writeRandomStringByRegexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…