File: xrand_example_test.go

package info (click to toggle)
golang-github-bradenaw-juniper 0.15.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 872 kB
  • sloc: sh: 27; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 299 bytes parent folder | download
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
package xrand_test

import (
	"fmt"
	"math/rand"

	"github.com/bradenaw/juniper/xmath/xrand"
)

func ExampleSample() {
	r := rand.New(rand.NewSource(0))

	sample := xrand.RSample(r, 100, 5)

	for _, x := range sample {
		fmt.Println(x)
	}

	// Unordered output:
	// 45
	// 71
	// 88
	// 93
	// 60
}