dijkstra is now bleching fast
deleting from the grid is now bleaching fast added new helper methods many new test-cases many new methods for geo classes and others added a bunch of new grid-walkers
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
#include <KLib/Assertions.h>
|
||||
|
||||
/**
|
||||
* add elements of a certain probability
|
||||
* and randomly draw from them
|
||||
@@ -68,6 +70,11 @@ public:
|
||||
|
||||
// binary search for the matching entry O(log(n))
|
||||
const auto tmp = std::lower_bound(elements.begin(), elements.end(), rndVal);
|
||||
|
||||
// sanity check
|
||||
_assertFalse(tmp == elements.end(), "draw() did not find a valid element");
|
||||
|
||||
// done
|
||||
return (*tmp).element;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user