title: Generate random number from an arbitrary weighted list
body: <p>Here's what I need to do, I'll be doing this both in PHP and JavaScript.</p>
  
  <p>I have a list of numbers that will range from 1 to 300-500 (I haven't set the limit yet). I will be running a drawing where 10 numbers will be picked at random from the given range.</p>
  
  <p>Here's the tricky part: I want some numbers to be less likely to be drawn up. A small set of those 300-500 will be flagged as "lucky numbers".</p>
  
  <p>For example, out of 100 drawings, most numbers have equal chances of being drawn, except for a few, that will only be picked once every 30-50 drawings.</p>
  
  <p>Basically I need to artificially set the probability of certain numbers to be picked while maintaining an even distribution with the rest of the numbers.</p>
  
  <p>The only similar thing I've found so far is this question: <a href="https://stackoverflow.com/questions/8435183/generate-a-weighted-random-number">Generate A Weighted Random Number</a>, the problem being that my spec has considerably more numbers (up to 500) so the weights would get very small and supposedly this could be a problem with that solution (Rejection Sampling). I'm still trying it, though, but I wonder if there other solutions.</p>
  
  <p>Math is not my thing so I appreciate any input. Thanks.</p>