Poisson-distributed Random Generator
Ir para navegação
Ir para pesquisar
It is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space if these events occur with a known constant mean rate and independently of the time since the last event.
Exemplo em Python
def pseudo_poisson(alpha, size=1):
"""
Poisson generator from uniform generator
"""
poisson = []
for _ in range(size):
# 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=5*alpha)
X,P,i = 0,1,0
while P >= np.exp(-alpha):
P = U[i]*P
X += 1
i += 1
poisson.append(X)
return np.array(poisson)