We also need a method to move through intersections. If there is more than one outgoing link, then the vehicle needs to select one of those. In Sec. 9.1 we will introduce route plans for this purpose. In order to test the code without that functionality, here we introduce a method with random selection of the outgoing link:
{} class Node { ... public: void rndmove() ; void move() { rndmove() ; } }and
/home/nagel/src/book/sim/book/Node::rndmove
Note that in contrast to earlier no ``->second'' is used with the iterator, since the VLinks is a standard vector (array) structure, and not a map.
myRand()
is a random number generator that returns values
between zero (included) and one (excluded), for example
{} double myRand() { return rand()/(RAND_MAX+1) ; }