summaryrefslogtreecommitdiff
path: root/numpy/random/mtrand.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random/mtrand.pyx')
-rw-r--r--numpy/random/mtrand.pyx16
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx
index edf812a4d..ca6ba9de8 100644
--- a/numpy/random/mtrand.pyx
+++ b/numpy/random/mtrand.pyx
@@ -537,6 +537,22 @@ cdef class RandomState:
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
+
See Also
--------
random.Generator.exponential: which should be used for new code.