Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public static BigInteger randomVeletlen(){
  2. while(true){
  3. int c=(int)(Math.random()*(fn.intValue()-2))+2;
  4. BigInteger a=BigInteger.valueOf(c);
  5. if(euklidesziAlg(fn,a,n).compareTo(new BigInteger("1"))==0){
  6. return a;
  7. }
  8. }
  9. }
  10.  
  11. public static BigInteger euklidesziAlg(BigInteger a, BigInteger b, BigInteger d){
  12. d = a;
  13. if (b.intValue() != 0){
  14. return euklidesziAlg(b, a.mod(b), d);
  15. }
  16. return d;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement