MCPcopy Create free account
hub / github.com/gobeam/stringy / Shuffle

Method Shuffle

stringy.go:314–323  ·  view source on GitHub ↗

Shuffle shuffles the given string randomly it can be chained on function which return StringManipulation interface

()

Source from the content-addressed store, hash-verified

312// Shuffle shuffles the given string randomly
313// it can be chained on function which return StringManipulation interface
314func (i *input) Shuffle() string {
315 input := getInput(*i)
316 rand.Seed(time.Now().Unix())
317
318 inRune := []rune(input)
319 rand.Shuffle(len(inRune), func(i, j int) {
320 inRune[i], inRune[j] = inRune[j], inRune[i]
321 })
322 return string(inRune)
323}
324
325// SnakeCase is variadic function that takes one Param slice of strings named rule
326// and it returns passed string in snake case form. Rule param helps to omit character

Callers

nothing calls this directly

Calls 2

getInputFunction · 0.85
ShuffleMethod · 0.65

Tested by

no test coverage detected