robbihun/NStatsD.Client — pull request #2 by JulianRooze (2013-03-08 23:59:14+00:00)
Title: Check for Config == null and randomness of Random

I added a check if Config is null. If so, it will silently return instead of crashing as I think that's preferable :)

In addition, I removed the line that creates an instance of Random every time Send is called as it's possible that when Send is called multiple times within the same time window of about 15 milliseconds, two instances will get the same seed value and thus will return the same 'random' values. Not a big deal, but I replaced it with a [ThreadStatic] instance that will prevent that, will be thread-safe and faster as well (creating an instance of Random seems to be fairly expensive, relatively speaking).

I also moved the Dictionary creation in the Send method until it's actually needed.