Is random.expovariate equivalent to a Poisson Process

hizki picture hizki · Dec 21, 2011 · Viewed 11.5k times · Source

I read somewhere that the python library function random.expovariate produces intervals equivalent to Poisson Process events.
Is that really the case or should I impose some other function on the results?

Answer

Adrian Ratnapala picture Adrian Ratnapala · Dec 21, 2011

On a strict reading of your question, yes, that is what random.expovariate does.

expovariate gives you random floating point numbers, exponentially distributed. In a Poisson process the size of the interval between consecutive events is exponential.

However, there are two other ways I could imagine modelling poisson processes

  1. Just generate random numbers, uniformly distributed and sort them.
  2. Generate integers which have a Poisson distribution (i.e. they are distributed like the number of events within a fixed interval in a Poisson process). Use numpy.random.poisson to do this.

Of course all three things are quite different. The right choice depends on your application.