protected long generateZeta(double ro,double pk,RandomEngine randomGenerator){
  double u, v, e, x;
  long k;
  if (ro != ro_prev || pk != pk_prev) {
    ro_prev=ro;
    pk_prev=pk;
    if (ro < pk) {
      c=pk - 0.5;
      d=0;
    }
 else {
      c=ro - 0.5;
      d=(1.0 + ro) * Math.log((1.0 + pk) / (1.0 + ro));
    }
  }
  do {
    do {
      u=randomGenerator.raw();
      v=randomGenerator.raw();
      x=(c + 0.5) * Math.exp(-Math.log(u) / ro) - c;
    }
 while (x <= 0.5 || x >= maxlongint);
    k=(int)(x + 0.5);
    e=-Math.log(v);
  }
 while (e < (1.0 + ro) * Math.log((k + pk) / (x + c)) - d);
  return k;
}

protected long generateZeta ( double ro , double pk , RandomEngine randomGenerator ) { double u , v , e , x ; long k ; if ( ro != ro_prev || pk != pk_prev ) { ro_prev = ro ; pk_prev = pk ; if ( ro < pk ) { c = pk - 0.5 ; d = 0 ; } else { c = ro - 0.5 ; d = ( 1.0 + ro ) * Math . log ( ( 1.0 + pk ) / ( 1.0 + ro ) ) ; } } do { do { u = randomGenerator . raw ( ) ; v = randomGenerator . raw ( ) ; x = ( c + 0.5 ) * Math . exp ( - Math . log ( u ) / ro ) - c ; } while ( x <= 0.5 || x >= maxlongint ) ; k = ( int ) ( x + 0.5 ) ; e = - Math . log ( v ) ; } while ( e < ( 1.0 + ro ) * Math . log ( ( k + pk ) / ( x + c ) ) - d ) ; return k ; }
returns a zeta distributed random number .
