title: Add a Rand to each row using Pandas' Assign and a Lambda Function
body: <p>How do I pass a random number to a lambda function, so that I can be used by the pandas <code>assign</code> to add a different random number to each row.</p>
  
  <p>My original attempt,</p>
  
  <pre><code>df = pd.DataFrame({'cat': [1]*10 + [0]*10,
                     'value': [3]*5 + [2]*5 + [2]*2 + [3]*8})
  
  df.assign(cat=lambda df: df.cat + np.random.rand(1)).head(3)
  
  Out[1]:
       cat        value
  0   1.962857    3
  1   1.962857    3
  2   1.962857    3
  </code></pre>
  
  <p>We see here that the the random number <code>0.962857</code> has been added to all rows. But I would like a different <code>rand</code> for each row. How can I do this?</p>