Exponential-distributed Random Generator
Ir para navegação
Ir para pesquisar
It is the continuous probability distribution of the time between events in a Poisson point process, i.e., a process in which events occur continuously and independently at a constant average rate.
For generating an Exponential distribution from a Uniform distribution, we can use a powerful technique called “Inverse Transform Method”. We don’t need to dwell on the theoretical details here, but ultimately this method links the two types of distributions through a simple mathematical transformation.
Sample Python Code
def pseudo_exp(lamb, size=1):
"""
Generates exponential distribution from uniform generator
"""
# Sets seed based on the decimal portion of the current system clock
t = time.perf_counter()
seed = int(10**9*float(str(t-int(t))[0:]))
U = pseudo_uniform(seed=seed, size=size)
X = -(1/lamb)*(np.log(1-U))
return X