How would I go about generating a number from a range, and making it so that each possibility in the range has a different probability? : <p>I want to figure out how to generate a number from a range, where each item in the range has a different probability of it being generated.</p>

<p>For instance, I want the chances to be:</p>

<pre><code>p=c(.1,.2,.3,.35, .02, .03)
</code></pre>

<p>For a range of 1-6.</p>

<p>I believe I need to use cumsum, but I'm not sure how to go about it.</p>
