{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "out",
              "annotation": "ndarray or scalar",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Drawn samples from the parameterized exponential distribution."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Draw samples from an exponential distribution."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "scale",
              "annotation": "float or array_like of floats",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The scale parameter, "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\beta = 1/\\lambda"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Must be non-negative."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "size",
              "annotation": "int or tuple of ints, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Output shape.  If the given shape is, e.g., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(m, n, k)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", then "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "m * n * k"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " samples are drawn.  If size is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (default), a single value is returned if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "scale"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a scalar.  Otherwise, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.array(scale).size"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " samples are drawn."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Its probability density function is"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f(x; \\frac{1}{\\beta}) = \\frac{1}{\\beta} \\exp(-\\frac{x}{\\beta}),"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x > 0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and 0 elsewhere. "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\beta"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the scale parameter, which is the inverse of the rate parameter "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\lambda = 1/\\beta"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The rate parameter is an alternative, widely used parameterization of the exponential distribution "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The exponential distribution is a continuous analogue of the geometric distribution.  It describes many common situations, such as the size of raindrops measured over many rainstorms "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", or the time between page requests to Wikipedia "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": null,
  "item_line": null,
  "item_type": "cython_function_or_method",
  "aliases": [
    "numpy.random.Generator.exponential"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Assume a company has 10000 customer support agents and the time\nbetween customer calls is exponentially distributed and that the\naverage time between customer calls is 4 minutes.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "scale, size = 4, 10000\nrng = np.random.default_rng()\ntime_between_calls = rng.exponential(scale=scale, size=size)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nWhat is the probability that a customer will call in the next\n4 to 5 minutes?\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = ((time_between_calls < 5).sum())/size\ny = ((time_between_calls < 4).sum())/size\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x - y\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe corresponding distribution can be visualized as follows:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\nscale, size = 4, 10000\nrng = np.random.default_rng()\nsample = rng.exponential(scale=scale, size=size)\ncount, bins, _ = plt.hist(sample, 30, density=True)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.plot(bins, scale**(-1)*np.exp(-scale**-1*bins), linewidth=2, color='r')\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "numpy",
          "version": "2.5.0.dev0+git20251130.2de293a",
          "kind": "assets",
          "path": "fig-abf1b5f9efb4f64f.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "scale",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1.0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "size",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "exponential"
  },
  "references": [
    ".. [1] Peyton Z. Peebles Jr., \"Probability, Random Variables and",
    "       Random Signal Principles\", 4th ed, 2001, p. 57.",
    ".. [2] Wikipedia, \"Poisson process\",",
    "       https://en.wikipedia.org/wiki/Poisson_process",
    ".. [3] Wikipedia, \"Exponential distribution\",",
    "       https://en.wikipedia.org/wiki/Exponential_distribution"
  ],
  "qa": "numpy.random._generator:Generator.exponential",
  "arbitrary": [],
  "local_refs": [
    "out",
    "scale",
    "size"
  ]
}