code: @Override
      public double rand() {
          if (lambda > 2E9) {
              throw new IllegalArgumentException("Too large lambda for random number generator.");
          }
  
          if (lambda == 0) {
              return 0;
          }
  
          // For extremely small L we calculate the probabilities of x = 1
          // and x = 2 (ignoring higher x). The reason for using this
          // method is to prevent numerical inaccuracies in other methods.
          if (lambda < 1.E-6) {
              return tinyLambdaRand(lambda);
          }
  
          if (rng == null) {
              if (lambda < 20) {
                  // down/up search from mode
                  // The computation time for this method grows with sqrt(L).
                  // Gives overflow for L > 60
                  rng = new ModeSearch();
              } else {
                  // patchword rejection method
                  // The computation time for this method does not depend on L.
                  // Use where other methods would be slower.
                  rng = new Patchwork();
              }
          }
  
          return rng.rand();
      }
docs: This function generates a random variate with the poisson distribution.
  <p>
  Uses down/up search from the mode by chop-down technique for &lambda; &lt; 20,
  and patchwork rejection method for &lambda; &ge; 20.
  <p>
  For &lambda; &lt; 1.E-6 numerical inaccuracy is avoided by direct calculation.