I was wondering if there was an easy way to generate 2 numbers and make sure that one is evenly divisible by the other.
This is what i have so far:
Random rand = new Random();
int d = rand.nextInt(90)*2 + 1;
int dd = rand.nextInt(d)+1;
I was wondering if there was an easy way to generate 2 numbers and make sure that one is evenly divisible by the other.
This is what i have so far:
Random rand = new Random();
int d = rand.nextInt(90)*2 + 1;
int dd = rand.nextInt(d)+1;
If you want to generate two numbers a and b where a divides b I.e. there exists an int k where a*k =b you can randomly generate a and then randomly generate k and multiply the two to get b.