summaryrefslogtreecommitdiff
path: root/numpy/random/_generator.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/_generator.pyx')
-rw-r--r--numpy/random/_generator.pyx16
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
index da66c1cac..a5ca1b9f1 100644
--- a/numpy/random/_generator.pyx
+++ b/numpy/random/_generator.pyx
@@ -380,6 +380,22 @@ cdef class Generator:
out : ndarray or scalar
Drawn samples from the parameterized exponential distribution.
+ Examples
+ --------
+ A real world example: Assume a company has 10000 customer support
+ agents and the average time between customer calls is 4 minutes.
+
+ >>> n = 10000
+ >>> time_between_calls = np.random.default_rng().exponential(scale=4, size=n)
+
+ What is the probability that a customer will call in the next
+ 4 to 5 minutes?
+
+ >>> x = ((time_between_calls < 5).sum())/n
+ >>> y = ((time_between_calls < 4).sum())/n
+ >>> x-y
+ 0.08 # may vary
+
References
----------
.. [1] Peyton Z. Peebles Jr., "Probability, Random Variables and