src/main/java/org/teachingextensions/logo/utils/MazeUtils/StdRandom.java
public static int geometric(double p)
  {
    if (!(p >= 0.0 && p <= 1.0))
      throw new IllegalArgumentException("Probability must be between 0.0 and 1.0");
    // using algorithm given by Knuth
    return (int) Math.ceil(Math.log(uniform()) / Math.log(1.0 - p));
  }
public static int geometric(double p)
  {
    if (!(p >= 0.0 && p <= 1.0))
      throw new IllegalArgumentException("Probability must be between 0.0 and 1.0");
    // using algorithm given by Knuth
    return (int) Math.ceil(Math.log(uniform()) / Math.log(1.0 - p));
  }
Returns a random integer from a geometric distribution with success
probability <em>p</em>.

@param  p the parameter of the geometric distribution
@return a random integer from a geometric distribution with success
probability <tt>p</tt>
@throws IllegalArgumentException unless <tt>p >= 0.0</tt> and <tt>p <= 1.0</tt>