Im trying to generate random numbers and i using BigInteger class to check if the generated numer is prime with probablePrime();
Here is my code:
btnRun.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Random prng = new Random();
Toast.makeText(getBaseContext()," " + BigInteger.probablePrime(10,prng), Toast.LENGTH_SHORT).show();
}
});
I dont really understand the first parameter in the probablePrime() wich in my case is 10. I Know its the byte off the int value, is this effecting the range of the generated numbers? Im only get values from 523-1003 BUT i want to generate random numbers from 1-anything and check them in the probablePrime(); method.
How is that possible?
Aucun commentaire:
Enregistrer un commentaire