How do i generate a histogram for a given probability distribution (for functional testing a server)?
<p>I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation)</p>

<p>I've chosen the <a href="http://en.wikipedia.org/wiki/Weibull_distribution" rel="nofollow">Weibull</a> distribution as it "sort of" matches the distribution I've observed (ramps up quickly, drops off quickly but not instantly)</p>

<p>I use this distribution to generate the number of requests that should be sent each day between a given start and end date</p>

<p>I've hacked together an algorithm in Python that sort of works but it feels kludgy:</p>

<pre><code>how_many_days = (end_date - start_date).days
freqs = defaultdict(int)
for x in xrange(how_many_responses):
    freqs[int(how_many_days * weibullvariate(0.5, 2))] += 1
timeline = []
day = start_date
for i,freq in sorted(freqs.iteritems()):
    timeline.append((day, freq))
    day += timedelta(days=1)
return timeline
</code></pre>

<p>What better ways are there to do this? </p>

<p>Why don't you try <a href="http://grinder.sourceforge.net" rel="nofollow">The Grinder 3</a> to load test your server, it comes with all this and more prebuilt, and it supports python as a scripting language</p>
