# i want generate random numbor b, but iam getting error

• 03-11-2011, 09:52 AM
ajay.eeralla
i want generate random numbor b, but iam getting error
Code:

```package pollardp1; import java.math.BigInteger; import java.security.SecureRandom; import java.util.*; import java.io.*; /**  *  * @author ajay  */ public class Pollardp1 { private final static BigInteger ZERO = new BigInteger("0");     private final static BigInteger ONE  = new BigInteger("1");     private final static BigInteger TWO = new BigInteger("2");  //private final static SecureRandom random = new SecureRandom();     /**     * @param args the command line arguments     */     public static void main(String[] args) {         // TODO code application logic here     System.out.println("Enter a number to be factor");       Scanner input=new Scanner(System.in);       BigInteger n=input.nextBigInteger();       Random rand = new Random();       BigInteger b=lnr(BigInteger.valueOf(rand.nextInt()),n);         //BigInteger b  =         BigInteger r2; int i=2;     BigInteger r=b.mod(n);     BigInteger gcd=r.subtract(ONE).gcd(n);     while(true){     while(gcd.equals(ONE))     {                           for(int j=1;j<i;j++)         {             r = r.multiply(r).mod(n);         gcd=(r.subtract(ONE)).gcd(n);     }     i++;     }     if(gcd.equals(n))     {         System.out.println(ONE + "," + gcd);         break;         }         else     {         System.out.println(gcd + "," + n.divide(gcd));         break;         }         }     }}```

Enter a number to be factor
632887
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code
at pollardp1.Pollardp1.main(Pollardp1.java:34)
Java Result: 1
BUILD SUCCESSFUL (total time: 14 seconds)
• 03-11-2011, 09:54 AM
Eranga
Are you sure that you've properly close all the statements in your code?
• 03-11-2011, 10:02 AM
Eranga
Oh yes. What you are trying to do with this?

Code:

`BigInteger b=lnr(BigInteger.valueOf(rand.nextInt()),n);`
• 03-12-2011, 11:37 AM
ajay.eeralla
i want generate random numbor b, but iam getting error
My intension is to generate b is random big integer having number of digits as in n..
• 03-14-2011, 06:59 AM
Eranga
Now please check what you have on,

Quote:

Pollardp1.java:34
hope you know the meaning of above line of quoted text.