panthrMath/distributions/geom.js
function rgeom(prob) {
      var scale;

      if (prob <= 0 || prob > 1) { return function() { return NaN; }; }

      scale = prob / (1 - prob);

      return function() {
         return rpois(rexp(scale)())();
      };
   }
function rgeom(prob) {
      var scale;

      if (prob <= 0 || prob > 1) { return function() { return NaN; }; }

      scale = prob / (1 - prob);

      return function() {
         return rpois(rexp(scale)())();
      };
   }
function rgeom ( prob ) { var scale ; if ( prob <= 0 || prob > 1 ) { return function ( ) { return NaN ; } ; } scale = prob / ( 1 - prob ) ; return function ( ) { return rpois ( rexp ( scale ) ( ) ) ( ) ; } ; }
Returns a random variate from the geometric distribution.

Expects the probability parameter $0 < p \leq 1$.

Following R's code (rgeom.c)
@fullName rgeom(prob)()
@memberof geometric
Returns a random variate from the geometric distribution .