Choose random files from a file

In macos

brew install coreutils
gshuf -n N input > output

In linux

shuf -n N input > output