title: How to generate list of unique random floats in Python
body: <p>I know that there are easy ways to generate lists of unique random integers (e.g. <code>random.sample(range(1, 100), 10)</code>).</p>
  
  <p>I wonder whether there is some better way of generating a list of unique random floats, apart from writing a function that acts like a range, but accepts floats like this:</p>
  
  <pre><code>import random
  
  def float_range(start, stop, step):
      vals = []
      i = 0
      current_val = start
      while current_val &lt; stop:
          vals.append(current_val)
          i += 1
          current_val = start + i * step
      return vals
  
  unique_floats = random.sample(float_range(0, 2, 0.2), 3)
  </code></pre>
  
  <p>Is there a better way to do this?</p>