Returns the index of a randomly chosen node in *nodes. Requires *nodes be non-empty.
| 174 | // Returns the index of a randomly chosen node in *nodes. |
| 175 | // Requires *nodes be non-empty. |
| 176 | static int RandomNode(std::mt19937 *rnd, Nodes *nodes) { |
| 177 | std::uniform_int_distribution<int> distribution(0, nodes->size() - 1); |
| 178 | return distribution(*rnd); |
| 179 | } |
| 180 | |
| 181 | // Returns the index of a randomly chosen edge in *edges. |
| 182 | // Requires *edges be non-empty. |