mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
This commit is contained in:
parent
08479174b3
commit
019b9e0507
2 changed files with 16 additions and 3 deletions
|
@ -1,5 +1,10 @@
|
|||
package slice
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func FindPos(s []string, v string) int {
|
||||
for i, sv := range s {
|
||||
if sv == v {
|
||||
|
@ -29,3 +34,8 @@ func Remove(s []string, v string) []string {
|
|||
}
|
||||
return s[:n]
|
||||
}
|
||||
|
||||
func GetRangomString(s []string) string {
|
||||
rand.Seed(time.Now().Unix())
|
||||
return s[rand.Intn(len(s))]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue