-1

A friend of mine is organizing a competition of sorts. He has asked to know if there is some software where one puts names of people who have answered correctly and then the software picks up a name and shares it as an answer. All names equally weighed and let the A.I. or whatever do its thing.

shirish
  • 12,356

1 Answers1

5

You can use shuf:

$ cat /tmp/names
Bob
Nancy
Margaret
Sam

$ shuf -n1 /tmp/names Margaret

The -n1 says "output 1 line".

Andy Dalton
  • 13,993