Ping-pong scheme

From Wikipedia, the free encyclopedia

A Ping-Pong scheme is a simple algorithm for distributing data packets across two paths.

If you had two paths A and B, then the algorithm would randomly start with 1 of the paths and then switch back and forth between the two.

If you were to get the next path from a function call, it would look like this in Python:



get_next_path():
    while True:
        yield 'A'
        yield 'B'