code: function randProbPrimeRounds(k,n) {
      var ans, i, divisible, B; 
      B=30000;  //B is largest prime to use in trial division
      ans=int2bigInt(0,k,0);
      
      //optimization: try larger and smaller B to find the best limit.
      
      if (primes.length==0)
        primes=findPrimes(30000);  //check for divisibility by primes <=30000
  
      if (rpprb.length!=ans.length)
        rpprb=dup(ans);
  
      for (;;) { //keep trying random values for ans until one appears to be prime
        //optimization: pick a random number times L=2*3*5*...*p, plus a 
        //   random element of the list of all numbers in [0,L) not divisible by any prime up to p.
        //   This can reduce the amount of random number generation.
        
        randBigInt_(ans,k,0); //ans = a random odd number to check
        ans[0] |= 1; 
        divisible=0;
      
        //check ans for divisibility by small primes up to B
        for (i=0; (i<primes.length) && (primes[i]<=B); i++)
          if (modInt(ans,primes[i])==0 && !equalsInt(ans,primes[i])) {
            divisible=1;
            break;
          }      
        
        //optimization: change millerRabin so the base can be bigger than the number being checked, then eliminate the while here.
        
        //do n rounds of Miller Rabin, with random bases less than ans
        for (i=0; i<n && !divisible; i++) {
          randBigInt_(rpprb,k,0);
          while(!greater(ans,rpprb)) //pick a random rpprb that's < ans
            randBigInt_(rpprb,k,0);
          if (!millerRabin(ans,rpprb))
            divisible=1;
        }
        
        if(!divisible)
          return ans;
      }  
    }
docs: return a k-bit probable random prime using n rounds of Miller Rabin (after trial division with small primes)