Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LengthFromSrc = 0;
- LengthFromDest = 0;
- TotalNumberHops = 0;
- X = SRC; /*Last Node Visited from Random walk starting at SRC;*/
- Y = DEST; /*Last Node Visited from Random walk starting at DEST;*/
- /* Randomly select a route length */
- do {
- Length = rand( ) % Max;
- while( Length < Min );
- while( TotalNumberHops < Length ) {
- Next = Toss Coin to Pick Random Walk from Src or from Dest;
- if( Next == RandWalkFromSrc ) {
- Z = Randomly select an adjacent node to X;
- TotalNumberHops = 1 + LengthFromSrc + LengthFromDest
- + shortest-path from Z to Y;
- if( TotalNumberHops > Length )
- break;
- X = Z; /*include the node in the route*/
- Store X in the route data structure
- LengthFromSrc++;
- }
- else { /* Next = RandWalkFromDest */
- Z = Randomly select an adjacent node to Y;
- TotalNumberHops = 1 + LengthFromSrc + LengthFromDest
- + shortest-path from Z to X;
- if( TotalNumberHops > Length )
- break;
- Y = Z;
- Store Y in the route data structure
- LengthFromDest++;
- }
- }
- do {
- Length = rand( ) % Max;
- while( Length < Min );
- while( TotalNumberHops < Length )
- do {
- Length = rand() % Max;
- }
- while( Length < Min );
- Length = Min + rand() % (Max - Min);
- Length = random number in the range [Min, Max)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement