I have to create a class that extends RandomGenerator
and produces a random prime number each time the user enters an interval in the main program.
I have created the constructors and the isPrime
method but I can't figure out what to do next... Any ideas?
Notes:
-
If the user enters only one number ( lets say: x ) then the interval will be (0,x).In other words we have to create either two methods either two constructors.
For example:
public int nextPrime(int n)
orpublic int nextPrime(int low,int high)
-
I am not allowed to use arrays (or other ready-made methods that make the problem way easier).
-
I searched everything that involved Random Prime Numbers Generators but I couldn't find anything similar to this.
Aucun commentaire:
Enregistrer un commentaire