title: How to randomly sample from a Scala list or array?
body: <p>I want to randomly sample from a Scala list or array (not an RDD), the sample size can be much longer than the length of the list or array, how can I do this <strong>efficiently</strong>? Because the sample size can be very big and the sampling (on different lists/arrays) needs to be done a large number of times.</p>
  
  <p>I know for a Spark RDD we can use takeSample() to do it, is there an equivalent for Scala list/array?</p>
  
  <p>Thank you very much.</p>