Extract a given number of randomly selected elements from a list

One of the problems from https://ocaml.org/learn/tutorials/99problems.html