1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 07:02:29 +08:00

doc: update doc for slice package

This commit is contained in:
dudaodong
2023-01-05 14:49:30 +08:00
parent 6498c7d68a
commit d8505d1a5f
4 changed files with 327 additions and 111 deletions

View File

@@ -85,7 +85,7 @@ func Compact[T comparable](slice []T) []T {
}
// Concat creates a new slice concatenating slice with any additional slices.
// Play:
// Play: https://go.dev/play/p/gPt-q7zr5mk
func Concat[T any](slice []T, slices ...[]T) []T {
result := append([]T{}, slice...)
@@ -771,7 +771,7 @@ func Reverse[T any](slice []T) {
}
}
// Shuffle creates an slice of shuffled values.
// Shuffle the slice.
// Play: https://go.dev/play/p/YHvhnWGU3Ge
func Shuffle[T any](slice []T) []T {
rand.Seed(time.Now().UnixNano())