title: Pandas: Random integer between values in two columns
body: <p>How can I create a new column that calculates random integer between values of two columns in particular row.</p>
  
  <p>Example df:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  data = pd.DataFrame({'start': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
                       'end': [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]})
  data = data.iloc[:, [1, 0]]
  </code></pre>
  
  <p>Result:</p>
  
  <p><a href="https://i.stack.imgur.com/2z55W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2z55W.png" alt="enter image description here"></a></p>
  
  <p>Now I am trying something like this:</p>
  
  <pre><code>data['rand_between'] = data.apply(lambda x: np.random.randint(data.start, data.end))
  </code></pre>
  
  <p>or</p>
  
  <pre><code>data['rand_between'] = np.random.randint(data.start, data.end)
  </code></pre>
  
  <p>But it doesn't work of course because data.start is a Series not a number.
  how can I used numpy.random with data from columns as vectorized operation?</p>