Skip to content

Commit

Permalink
add links
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessCheng committed May 14, 2021
1 parent 7b8290d commit 9c7deb7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main/testutil/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ func (r *RG) FloatSlice(size int, min, max float64, precision int) []float64 {
return a
}

// TODO: O(size) 做法 https://mivik.blog.luogu.org/the-art-of-randomness
func (r *RG) uniqueSlice(size int, min, max int) []int {
if size > max-min+1 {
panic("size is too large")
Expand Down Expand Up @@ -217,6 +218,9 @@ func (r *RG) UniquePoints(n, minX, maxX, minY, maxY int) (points [][2]int) {
return
}

// 随机父节点
// 期望树高 https://blog.csdn.net/EI_Captain/article/details/109910307
// 更严格的随机树见 https://mivik.blog.luogu.org/the-art-of-randomness
func (r *RG) treeEdges(n, st int) (edges [][2]int) {
edges = make([][2]int, 0, n-1)
for i := 1; i < n; i++ {
Expand Down Expand Up @@ -375,3 +379,5 @@ func (r *RG) GraphHackSPFA(n, row, st, minWeight, maxWeight int) (edges [][3]int
}
return
}

// TODO: 随机括号序列 https://mivik.blog.luogu.org/the-art-of-randomness

0 comments on commit 9c7deb7

Please sign in to comment.