Add support for Poisson injector. Allows randomized load profiles.

This is a rewrite of #1987. Injection now runs for a fixed duration. As a consequence, the number of users can vary from run-to run, depending on the seed, but is deterministic for a given seed.

Also, some of the maths in the original PR was a little suspect, so I've switched to Lewis and Shedler's algorithm, which should be more accurate.
@pdalpra <https://github.com/pdalpra>: I'll be happy to get the explanation?


On Tue, Jul 1, 2014 at 3:40 PM, Stephane Landelle <notifications@github.com>
wrote:

> In
> gatling-core/src/main/scala/io/gatling/core/controller/inject/InjectionStep.scala:
>
> > + *
> > + * @param duration the length of time this injector should run for
> > + * @param startRate initial injection rate for users
> > + * @param endRate final injection rate for users
> > + * @param seed a seed for the randomization. If the same seed is re-used, the same timings will be obtained
> > + */
> > +case class PoissonInjection(duration: FiniteDuration, startRate: Double, endRate: Double, seed: Long = System.nanoTime) extends InjectionStep {
> > +  private val durationSecs = duration.toUnit(TimeUnit.SECONDS)
> > +  val users = chain(Iterator.empty).size
> > +
> > +  override def chain(chained: Iterator[FiniteDuration]): Iterator[FiniteDuration] = {
> > +    val rand = new Random(seed)
> > +
> > +    // Uses Lewis and Shedler's thinning algorithm: http://www.dtic.mil/dtic/tr/fulltext/u2/a059904.pdf
> > +    val maxLambda = startRate max endRate
> > +      def shouldKeep(d: Double) = {
>
> No, that's not a bug, embedded methods are padded. Ask @pdalpra
> <https://github.com/pdalpra>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/excilys/gatling/pull/1990/files#r14403693>.
>