August 27, 2024

P23 - Extract a given number of randomly selected elements from a list.

Example:

scala

scala> randomSelect(3, List('a, 'b, 'c, 'd, 'f, 'g, 'h))
res0: List[Symbol] = List('e, 'd, 'a)

Hint: Use the solution to problem P20

Be first to comment
Leave a reply