MCPcopy Create free account
hub / github.com/davisking/dlib / pick_random_source_and_sink

Function pick_random_source_and_sink

dlib/test/graph_cuts.cpp:591–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589
590 template <typename graph_type>
591 void pick_random_source_and_sink (
592 dlib::rand& rnd,
593 const graph_type& g,
594 unsigned long& source,
595 unsigned long& sink
596 )
597 {
598 source = rnd.get_random_32bit_number()%g.number_of_nodes();
599 sink = rnd.get_random_32bit_number()%g.number_of_nodes();
600 while (sink == source)
601 sink = rnd.get_random_32bit_number()%g.number_of_nodes();
602 }
603
604// ----------------------------------------------------------------------------------------
605

Callers 2

make_random_graphFunction · 0.85
make_random_chain_graphFunction · 0.85

Calls 2

number_of_nodesMethod · 0.45

Tested by

no test coverage detected