hind_d
hind_d

Reputation: 355

how to generate random timestamp that satisfying poisson distribution in java

I want to generate a series of timestamps that satisfying a poisson distribution, Is it possible?

More specifically, I'd like to pass two long values to indicate the start and end timestamp, and I want to generate timestamps that lie between these two end points, and those timestamps should be satisfying a specified poisson distribution with given lambda.

I've googleed the topic about generating random data with poisson distribution, but most results merely described how to generate random poisson integers. I've kind of stucking on this, any idea is welcome.

Upvotes: 0

Views: 357

Answers (1)

Tim B
Tim B

Reputation: 41188

Just generate a random poisson integer for the number of seconds between the start and end timestamps - then add that many seconds to the first timestamp for your random time.

Upvotes: 1

Related Questions