-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslice_test.go
More file actions
43 lines (29 loc) · 779 Bytes
/
slice_test.go
File metadata and controls
43 lines (29 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package random_test
import (
"fmt"
"atomicgo.dev/random"
)
func ExampleEntry() {
random.Seed(1337) // Set seed for deterministic output, not required
s := []int{1, 2, 3, 4, 5}
fmt.Print(random.Entry(s))
// Output: 4
}
func ExampleEntries() {
random.Seed(1337) // Set seed for deterministic output, not required
s := []int{1, 2, 3, 4, 5}
fmt.Print(random.Entries(s, 3))
// Output: [4 4 5]
}
func ExampleEntriesUnique() {
random.Seed(1337) // Set seed for deterministic output, not required
s := []int{1, 2, 3, 4, 5}
fmt.Print(random.EntriesUnique(s, 3))
// Output: [4 5 2]
}
func ExampleShuffle() {
random.Seed(1337) // Set seed for deterministic output, not required
s := []int{1, 2, 3, 4, 5}
fmt.Print(random.Shuffle(s))
// Output: [1 3 5 2 4]
}