Fix keygen random number initialization