In some cases keys are randomly generated using a random number generator ( RNG ) or pseudorandom number generator ( PRNG ) , the latter being a computer algorithm that produces data which appears random under analysis . In some cases keys are randomly generated using a random number generator ( RNG ) or pseudorandom number generator ( PRNG ) . A PRNG is a computer algorithm that produces data that appears random under analysis .