I would like to select the exact number of rows randomly from my PySpark DataFrame. I know of the function sample(). But it won't let me input the exact number of rows I want. The problem is when I do sampled_df = df.sample(0.2), if my df has 1,000,000 rows, I don't necessarily get 200,000 rows in sampled_df