About requesting your CRC algorithm ...
It looks like you are looking for an algorithm that will run in a random list of less than 16-bit numbers less than 64 KB in size and generate a new 16-bit number that is not yet in the list; it is preferable to do this in one go through this list.
If the sequence in which the identifiers are freed has nothing to do with the sequence in which they are allocated (for example, I feel that this is your case), you can do nothing with the generation or distribution of identifiers to get your algorithm.
The best bet then seems 5 from your list.
If you are adventurous ...
and if you can re-specify your identifiers (that is, change the highlighted identifier to another unallocated identifier), you can run a defrag iteration once in a while to move all highlighted identifiers to lower values and find the highest free identification number for next distribution. This will help to remember the total number of distributions and releases made since the last such “defragmentation”. Highlight increment sequentially, starting at 0.
Thus, you only need to remember 3 unsigned short integers in memory. And yes, take the slightly expensive iteration of redistribution once in a while, based on their values.
source share