File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,6 @@ import (
24
24
"bufio"
25
25
"encoding/csv"
26
26
"fmt"
27
- "github.com/google/uuid"
28
- "github.com/ugol/jr/pkg/constants"
29
- "github.com/ugol/jr/pkg/ctx"
30
- "golang.org/x/text/cases"
31
- "golang.org/x/text/language"
32
27
"log"
33
28
"math"
34
29
"math/rand"
@@ -37,6 +32,12 @@ import (
37
32
"strconv"
38
33
"strings"
39
34
"text/template"
35
+
36
+ "github.com/google/uuid"
37
+ "github.com/ugol/jr/pkg/constants"
38
+ "github.com/ugol/jr/pkg/ctx"
39
+ "golang.org/x/text/cases"
40
+ "golang.org/x/text/language"
40
41
)
41
42
42
43
func FunctionsMap () template.FuncMap {
@@ -47,6 +48,8 @@ var Random = rand.New(rand.NewSource(0))
47
48
var data = map [string ][]string {}
48
49
var fmap = map [string ]interface {}{
49
50
51
+ "inject" : Inject ,
52
+
50
53
// text utilities
51
54
"atoi" : Atoi ,
52
55
"itoa" : strconv .Itoa ,
@@ -523,3 +526,10 @@ func InitCSV(csvpath string) {
523
526
}
524
527
525
528
}
529
+
530
+ func Inject (perc float64 , injected , orig string ) string {
531
+ if rand .Float64 () < perc {
532
+ return injected
533
+ }
534
+ return orig
535
+ }
You can’t perform that action at this time.
0 commit comments