MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / randomSleep

Function randomSleep

example/E03-ThirdFlow.cpp:19–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static const char* RESULT_TOPIC_NAME = "example/result/topic";
18
19int randomSleep(int start, int range) {
20 // 随机休息一下,模拟处理的耗时
21 int ms = std::abs((int)std::random_device{}()) % range + start;
22 CGRAPH_SLEEP_MILLISECOND(ms);
23 return ms;
24}
25
26struct InputMParam : public GMessageParam {
27 int num_ = 0;

Callers 3

runMethod · 0.85
runMethod · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected