title: How to shuffle a list?
body: <p>How can I sample without replacement from a set of numbers (<code>[1, 2, 3]</code>) until I hit <code>x</code>?
   My plan was to shuffle the list <code>[1, 2, 3]</code> and chop it at <code>x</code>:</p>
  
  <pre><code>-- chopAt 3 [2, 3, 1] == [2, 3]
  -- chopAt 3 [2, 1, 3] == [2, 1, 3]
  -- chopAt 3 [3, 1, 2] == [3]
  chopAt _ [] = []
  chopAt x (y:ys)
    | x /= y    = y : chopAt x ys
    | otherwise = [y]
  </code></pre>
  
  <p>However I could not figure out how to shuffle the list (or understand Monads yet).</p>
  
  <pre><code>-- sample without replacement from [1, 2, 3] until one hits a 3
  -- x &lt;- shuffle [1, 2, 3]
  -- print (chopAt 3 x)
  main = do
  -- shuffle [1, 2, 3]
    print (chopAt 3 [1, 3, 2])
  </code></pre>