title: how to figure out which variable to use on the basis of weight?
body: <p>Let's say I have 5 variables v1, v2, v3, v4, v5 with weights as follows:</p>
  <pre><code>v1 = 30
  v2 = 20
  v3 = 10
  v4 = 25
  v5 = 15
  </code></pre>
  <p>I want some formula which if i run 100 times will yield v1 30 times, v2 20 times, v3 10 times, v4 25 times, v5 15 times.</p>
  <p>Note: The order of variables should be random.</p>
  <p>Context:
  We are going to run some parallel campaigns on our site. Weight will be assigned to each campaign to specify the percentage of sessions a campaign should be displayed in e.g. to perform an A/B testing, admin will specify 50 weight for campaign 1 and 50 weight for campaign 2.</p>