github.com/hdt3213/godis@v1.2.9/datastruct/sortedset/skiplist_test.go (about)

     1  package sortedset
     2  
     3  import "testing"
     4  
     5  func TestRandomLevel(t *testing.T) {
     6  	m := make(map[int16]int)
     7  	for i := 0; i < 10000; i++ {
     8  		level := randomLevel()
     9  		m[level]++
    10  	}
    11  	for i := 0; i <= maxLevel; i++ {
    12  		t.Logf("level %d, count %d", i, m[int16(i)])
    13  	}
    14  }