| 189 | // This will "randomly" visit nodes biased towards lower values first |
| 190 | template<typename T_VISITOR> |
| 191 | size_t random_visit(T_VISITOR &fn) |
| 192 | { |
| 193 | bool fSawAny = true; |
| 194 | size_t visited = 0; |
| 195 | size_t basePrimary = rand() % m_data.size(); |
| 196 | for (size_t idxSecondary = 0; fSawAny; ++idxSecondary) |
| 197 | { |
| 198 | fSawAny = false; |
| 199 | for (size_t idxPrimaryCount = 0; idxPrimaryCount < m_data.size(); ++idxPrimaryCount) |
| 200 | { |
| 201 | size_t idxPrimary = (basePrimary + idxPrimaryCount) % m_data.size(); |
| 202 | if (m_data[idxPrimary] != nullptr && idxSecondary < m_data[idxPrimary]->size()) |
| 203 | { |
| 204 | ++visited; |
| 205 | fSawAny = true; |
| 206 | if (!fn(m_data[idxPrimary]->operator[](idxSecondary))) |
| 207 | return visited; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | return visited; |
| 212 | } |
| 213 | |
| 214 | const T& random_value() const |
| 215 | { |
nothing calls this directly
no test coverage detected