On top of what Carlo said in solution 1, there are two more issues:
Quote:
return x == 0 || x == width || y == 0 || y == height;
Never compare floating point variables using == or != . These values are prone to subtle variations due to rounding effects, and therefore a direct comparison will almost always fail, even when, mathematically, it should succeed.
That said, since you are adding random values to x and y, you will probably never end exactly on the border - instead you'll move right past it! Therefore, rather than checking whether you are on the border, you should check whether you are outside! Alternately you should fix the update method to stop at the border.
Secondly:
for(Survivor i : survivors)
This code will create a copy of the vector element. Therefore the update will not change any vector element, only it's copy. You might want to try
for(Survivor& i : survivors)
instead, or simply
for(auto& i : survivors)