MCPcopy Index your code
hub / github.com/python/cpython / expovariate

Method expovariate

Lib/random.py:605–623  ·  view source on GitHub ↗

Exponential distribution. lambd is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if lambd is positive, and from negative

(self, lambd=1.0)

Source from the content-addressed store, hash-verified

603 return _exp(self.normalvariate(mu, sigma))
604
605 def expovariate(self, lambd=1.0):
606 """Exponential distribution.
607
608 lambd is 1.0 divided by the desired mean. It should be
609 nonzero. (The parameter would be called "lambda", but that is
610 a reserved word in Python.) Returned values range from 0 to
611 positive infinity if lambd is positive, and from negative
612 infinity to 0 if lambd is negative.
613
614 The mean (expected value) and variance of the random variable are:
615
616 E[X] = 1 / lambd
617 Var[X] = 1 / lambd ** 2
618
619 """
620 # we use 1-random() instead of random() to preclude the
621 # possibility of taking the log of zero.
622
623 return -_log(1.0 - self.random()) / lambd
624
625 def vonmisesvariate(self, mu, kappa):
626 """Circular data distribution.

Calls 1

randomMethod · 0.45