MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / cluster_seedgen

Function cluster_seedgen

rtpose_wrapper/src/caffe/common.cpp:23–40  ·  view source on GitHub ↗

random seeding

Source from the content-addressed store, hash-verified

21
22// random seeding
23int64_t cluster_seedgen(void) {
24 int64_t s, seed, pid;
25 FILE* f = fopen("/dev/urandom", "rb");
26 if (f && fread(&seed, 1, sizeof(seed), f) == sizeof(seed)) {
27 fclose(f);
28 return seed;
29 }
30
31 LOG(INFO) << "System entropy source not available, "
32 "using fallback algorithm to generate seed instead.";
33 if (f)
34 fclose(f);
35
36 pid = getpid();
37 s = time(NULL);
38 seed = std::abs(((s * 181) * ((pid - 83) * 359)) % 104729);
39 return seed;
40}
41
42
43void GlobalInit(int* pargc, char*** pargv) {

Callers 3

GeneratorMethod · 0.85
CaffeMethod · 0.85
SetDeviceMethod · 0.85

Calls 1

timeFunction · 0.85

Tested by

no test coverage detected