The document presents an adaptive key generation algorithm based on software engineering techniques. The algorithm uses self-checking processes to detect faults in generated keys and ensure randomness. It generates 128-bit keys using a shift register and SIGABA technique. Keys are tested against NIST standards and regenerated if they fail. Case studies show the algorithm effectively produces random keys that pass the tests. The algorithm adopts software engineering processes to reliably generate secure keys resistant to attacks.