title: generate a random number between 1 and x where a lower number is more likely than a higher one
body: <p>This is more of a maths/general programming question, but I am programming with PHP is that makes a difference.</p>
  
  <p>I think the easiest way to explain is with an example.</p>
  
  <p>If the range is between 1 and 10.</p>
  
  <p>I want to generate a number that is between 1 an 10 but is more likely lower than high.</p>
  
  <p>The only way I can think is generate an array with 10 elements equal to 1, 9 elements equal to 2, 8 elements equal to 3.....1 element equal to 10. Then generate a random number based on the number of elements.</p>
  
  <p>The trouble is I am potentially dealing with 1 - 100000 and that array would be ridiculously big.</p>
  
  <p>So how best to do it?</p>