title: How to generate a random list of fixed length of values from given range?
body: <p>How to generate a random (but unique and sorted) list of a fixed given length out of numbers of a given range in Python?</p>
  
  <p>Something like that:</p>
  
  <pre><code>&gt;&gt;&gt; list_length = 4
  &gt;&gt;&gt; values_range = [1, 30]
  &gt;&gt;&gt; random_list(list_length, values_range)
  
  [1, 6, 17, 29]
  
  &gt;&gt;&gt; random_list(list_length, values_range)
  
  [5, 6, 22, 24]
  
  &gt;&gt;&gt; random_list(3, [0, 11])
  
  [0, 7, 10]
  </code></pre>