The number of bits is fed to the input. Based on their number, a random prime number of the BigInteger type is generated. I have a check function for simplicity. But I don’t know how to generate from bits

  • Each bit is a random number of zero or one. - Igor
  • What is the dependence of a random number and input bits? I think that as soon as you answer this question, then you will understand how to solve the problem. Now the task of the form "to encode something, I do not know what." - AK
  • 3
    And if not a duplicate ? - EvgeniyZ
  • Just a простое number? See the RSA key generation algorithm. - NewView
  • Count all the primes that fit into these bits, and randomly pick one. - Igor

0