MCPcopy Create free account
hub / github.com/apache/mesos / selectRandomPort

Function selectRandomPort

src/tests/containerizer/ports_isolator_tests.cpp:126–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124// Select a random port from an offer.
125template <typename R>
126static uint16_t selectRandomPort(const R& resources)
127{
128 auto ports = resources.ports()->range(0);
129 return ports.begin() + std::rand() % (ports.end() - ports.begin() + 1);
130}
131
132
133// Select a random port that is not the same as the one given.

Callers 2

selectOtherPortFunction · 0.85
TEST_FFunction · 0.85

Calls 3

portsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected