MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / random

Method random

src/class149/SkipList1.java:69–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67
68 // 扔骰子决定节点的层数
69 public static int random() {
70 int ans = 1;
71 while (Math.random() < 0.5) {
72 ans++;
73 }
74 return Math.min(ans, MAXL);
75 }
76
77 // 当前在i号节点的h层,返回key为num的节点,空间编号是多少
78 public static int find(int i, int h, int num) {

Callers 15

addMethod · 0.95
mainMethod · 0.45
randomArrayMethod · 0.45
addMethod · 0.45
addMethod · 0.45
randomArrayMethod · 0.45
mainMethod · 0.45
randomizedSelectMethod · 0.45
randomArrayMethod · 0.45
mainMethod · 0.45
randomArrayMethod · 0.45
mainMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected