title: Spark dataframe add new column with random data
body: <p>I want to add a new column to the dataframe with values consist of either 0 or 1.
  I used 'randint' function from,</p>
  
  <pre><code>from random import randint
  
  df1 = df.withColumn('isVal',randint(0,1))
  </code></pre>
  
  <p>But I get the following error,</p>
  
  <blockquote>
    <p>/spark/python/pyspark/sql/dataframe.py", line 1313, in withColumn
        assert isinstance(col, Column), "col should be Column"
    AssertionError: col should be Column</p>
  </blockquote>
  
  <p>how to use a custom function or randint function for generate random value for the column? </p>