# How to construct a random error-correcting code (its generator matrix) according to the code parameters?

I need to construct a random code which corrects T errors, has R check bits and has N maximum bits in the transmitting word.

I have researched the topic and found a few theorems about the bounds (The Varshamov-Gilbert bound, for instance). Neither of them suggests an algorithm of how to construct the code.

How do I build the random code with the specified parameters? I assume the algorithm should be probabilistic, but I'm not certain.

• The Gilbert-Varshamov bound can be proved algorithmically, though the algorithm isn't efficient (it runs in exponential time). – Yuval Filmus Jun 3 at 9:22
• Generally speaking, the problem of determining the optimal tradeoff between the parameters $T,R,N$ is very hard, so you shouldn't expect any simple algorithm that works in general. – Yuval Filmus Jun 3 at 12:36
• Thank you. I've come across several proofs, where they use a probabilistic approach. But I still don't understand how to build the code from scratch. There are some methods, as they call them "Building codes from other codes", such as the parity check bit method or the puncturing method, which are based upon some already existing codes. The methods are discussed in the Algorithmic Introduction to Coding Theory lectures by M. Sudan. – Evgeny Mamaev Jun 3 at 13:57
• Coding theory is a vast topic. Entire books have been written on it. This makes your question quite broad. – Yuval Filmus Jun 3 at 13:59
• The task I'm trying to accomplish is to write an algorithm, which accepts three numbers, named T, R, N, and shows the generator matrix of the code as a result. Let it be an arbitrary code without any specific constraints on the input parameters. – Evgeny Mamaev Jun 3 at 14:09

If you need to support only erasures, there is simple to describe algorithm - consider input words as values of some polynomial at points 0..n-1, and compute (using a Galois Field) values of the same polynomial at points n..n+m-1 - it will be possible to restore polynomial coefficients from any n survived values.