MCPcopy Create free account
hub / github.com/e2wugui/zeze / randCreateTask

Method randCreateTask

ZezeJava/ZezeJavaTest/src/Infinite/Tasks.java:146–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144 }
145
146 static Task randCreateTask() {
147 var rand = Random.getInstance().nextInt(TotalWeight);
148 for (var task : taskFactorys) {
149 if (rand < task.Weight)
150 return task.Factory.get();
151 rand -= task.Weight;
152 }
153 throw new RuntimeException("impossible!");
154 }
155
156 static void prepare() throws Exception {
157 for (var tf : taskFactorys)

Callers 1

testMainMethod · 0.95

Calls 3

getInstanceMethod · 0.95
getMethod · 0.65
nextIntMethod · 0.45

Tested by

no test coverage detected