Niv wrote:
> I have to generate some unique codes of 16 bits length, but each code
> must be at least differnt by 5 bits from any other code.
Brian Drummond wrote:
> Since there are only 2^16 codes to test, I would use a sieve, like
> "Sieve of Eratosthenes" but testing for Hamming distance instead of
> primeness.
As it happens, I have a C program that does that. I dusted it off and put
it on my web site:
http://www.brouhaha.com/~eric/software/hamming/
In addition to the source code, there's a file giving the 256 16-bit
codes with a minimum distance of 5. Thus this code could be used to
detect all three-bit errors in eight bits of data, and correct all
single- and two-bit errors.