The security of the RSA encryption algorithm is built on the mathematical challenge of factoring the product of two large prime numbers. Donald Knuth(American computer scientist, mathematician, and professor emeritus at Stanford University, the 1974 recipient of the ACM Turing Award, often called the 'father of the analysis of algorithms') Generating Large Primes
Random numbers should not be generated with a method chosen at random.