Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Reverse ¶
func Reverse[T any, Slice ~[]T](collection Slice)
Reverse reverses array so that the first element becomes the last, the second element becomes the second to last, and so on. Play: https://go.dev/play/p/iv2e9jslfBM
Example ¶
list := []int{0, 1, 2, 3, 4, 5} Reverse(list) fmt.Printf("%v", list)
Output: [5 4 3 2 1 0]
func Shuffle ¶
func Shuffle[T any, Slice ~[]T](collection Slice)
Shuffle returns an array of shuffled values. Uses the Fisher-Yates shuffle algorithm. Play: https://go.dev/play/p/ZTGG7OUCdnp
Example ¶
list := []int{0, 1, 2, 3, 4, 5} Shuffle(list) fmt.Printf("%v", list)
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.