I need help figuring out if two numbers are co-prime.

So far I have this (prime() is a bool function)

```
void GetE(int& e, int& result)
{
int random = rand();
do{
while(prime(random))
{
if(random < result)
e = random;
else
random = rand();
}
while(!prime(random))
{
random = rand();
}
}while(prime(random) && random < result);
}
```

As you can see:

- I have an int result (already found through previous functions)

- I need to generate a random number.

- If that number is prime, and if less than result, I got my number.

- Else, get a new random number.

My goal is to get a random PRIME number that is LESS than result.

I could also use a coprime to result, but am unsure how to code that using the Euclidean Algorithm. I've tried but can't get it to work.

Also, cplusplus.com is down now so I can't use that as a reference, which I need to :(

Thanks in advance for any help.