How do I pick a random player for a function?

I was wondering if i could do the same thing but in a specific team ?