MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / rand_setSeeds

Function rand_setSeeds

quest/src/core/randomiser.cpp:59–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59void rand_setSeeds(vector<unsigned> seeds) {
60
61 // this function consults only root-node seeds, broadcasting
62 // to other nodes which might not have the existing space to
63 // receive them, so we explicitly reserve the needed space
64
65 // all nodes learn root node's #seeds
66 unsigned numRootSeeds = seeds.size();
67 if (comm_isInit())
68 comm_broadcastUnsignedsFromRoot(&numRootSeeds, 1);
69
70 // all nodes ensure they have space to receive root node's seeds
71 seeds.resize(numRootSeeds);
72
73 // all nodes receive root seeds
74 if (comm_isInit())
75 comm_broadcastUnsignedsFromRoot(seeds.data(), seeds.size());
76
77 // all nodes remember seeds (in case user wishes to later recall them)
78 currentSeeds = seeds;
79
80 // all nodes pass all seeds to RNG
81 std::seed_seq seq(seeds.begin(), seeds.end());
82 mainGenerator.seed(seq);
83}
84
85
86void rand_setSeedsToDefault() {

Callers 2

rand_setSeedsToDefaultFunction · 0.85
setSeedsFunction · 0.85

Calls 2

comm_isInitFunction · 0.85

Tested by

no test coverage detected