Add random key generator to codes