github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/internal/randvar/weighted_test.go (about)

     1  // Copyright 2019 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  package randvar
     6  
     7  import "testing"
     8  
     9  func TestWeighted(t *testing.T) {
    10  	w := NewWeighted(nil, 1, 2, 2, 0, 3)
    11  
    12  	x := make([]int, 10000)
    13  	for i := range x {
    14  		x[i] = w.Int()
    15  	}
    16  
    17  	if testing.Verbose() {
    18  		dumpSamples(x)
    19  	}
    20  }