Use random int as init value.
Thanks for the patch. Would it be better to just get a random int in getPartition()? In the current approach, if the multiple producer instances somehow get into the lock-step mode, they will never get out of that mode, if partitions are always available.
Good point. Attached v2 for that, also tested that Random.nextInt will not return the same numbers even being called at roughly the same time.
It might work better if we seed the random with the current timestamp - http://docs.oracle.com/javase/6/docs/api/java/util/Random.html#Random(long)
Not sure how good Scala's Random implementation is, I tend to trust Java more on that.
I tested the Random implementation a bit and the results look good. One thing of using timestamp is that producer clients may start at roughly the same time, and I do not know if there is a correlation between numeric difference of seed values and the numeric difference between the generated values.
Though it is unlikely that the nanosecond timestamp across producer instances would match, I don't feel strongly about the change.
Thanks for patch v2. +1. Committed to 0.8.