public static int geometric(double p){
  return (int)Math.ceil(Math.log(uniform()) / Math.log(1.0 - p));
}

public static int geometric ( double p ) { return ( int ) Math . ceil ( Math . log ( uniform ( ) ) / Math . log ( 1.0 - p ) ) ; }
return an integer with a geometric distribution with mean 1 / p .
