Skip to content

Commit

Permalink
Fix dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
btracey committed Aug 1, 2017
1 parent 50a32cd commit 565eff9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions stat/sampleuv/withoutreplacement.go
Expand Up @@ -9,8 +9,8 @@ import (
"sort"
)

// WithoutReplacement samples len(idx) integers from [0, max) without replacement.
// That is, upon return the elements of idx will be unique integers. If source
// WithoutReplacement samples len(idxs) integers from [0, max) without replacement.
// That is, upon return the elements of idxs will be unique integers. If source
// is non-nil it will be used to generate random numbers, otherwise the default
// source from the math/rand package will be used.
func WithoutReplacement(idxs []int, n int, src *rand.Rand) {
Expand All @@ -19,9 +19,9 @@ func WithoutReplacement(idxs []int, n int, src *rand.Rand) {
}

// There are two algorithms. One is to generate a random permutation
// and take the first len(idx) elements. The second is to generate
// and take the first len(idxs) elements. The second is to generate
// individual random numbers for each element and check uniqueness. The first
// method scales as O(max), and the second scales as O(len(idx)^2). Choose
// method scales as O(max), and the second scales as O(len(idxs)^2). Choose
// the algorithm accordingly.
if n < len(idxs)*len(idxs) {
var perm []int
Expand Down
1 change: 0 additions & 1 deletion stat/sampleuv/withoutreplacement_test.go
Expand Up @@ -46,7 +46,6 @@ func TestWithoutReplacement(t *testing.T) {
}
}
if !allDiff {
_ = cas
t.Errorf("Cas %d: Repeat in sampling. Idxs =%v", cas, idxs)
}
for _, v := range idxs {
Expand Down

0 comments on commit 565eff9

Please sign in to comment.