+ * The "searchable queues" algorithm used in this IP ID implementation was
+ * proposed by Amit Klein. It is a compromise between the above two
+ * viewpoints that has provable behavior that can be tuned to the user's
+ * requirements.
+ *
+ * The basic concept is that we supplement a standard random number generator
+ * with a queue of the last L IDs that we have handed out to ensure that all
+ * IDs have a period of at least L.
+ *
+ * To efficiently implement this idea, we keep two data structures: a
+ * circular array of IDs of size L and a bitstring of 65536 bits.
+ *
+ * To start, we ask the RNG for a new ID. A quick index into the bitstring
+ * is used to determine if this is a recently used value. The process is
+ * repeated until a value is returned that is not in the bitstring.
+ *
+ * Having found a usable ID, we remove the ID stored at the current position
+ * in the queue from the bitstring and replace it with our new ID. Our new
+ * ID is then added to the bitstring and the queue pointer is incremented.
+ *
+ * The lower limit of 512 was chosen because there doesn't seem to be much
+ * point to having a smaller value. The upper limit of 32768 was chosen for
+ * two reasons. First, every step above 32768 decreases the entropy. Taken
+ * to an extreme, 65533 would offer 1 bit of entropy. Second, the number of
+ * attempts it takes the algorithm to find an unused ID drastically
+ * increases, killing performance. The default value of 4096 was chosen
+ * because it provides a good tradeoff between randomness and non-repetition,
+ * while taking performance into account.
+ *
+ * With L=4096, the queue will use 8K of memory. The bitstring always uses
+ * 8K of memory (2^16/8). This yields to around 7% ID collisions. No memory
+ * is allocated until the use of random ids is enabled.