When collecting data on what people do, you need to communicate with them (unless you are doing observation only), and you need some system for deciding who you will select for communicating with (i.e. interviewing, online survey, etc.).
These people you select are your sample.
A truly random sample means that everyone within a pool of possible respondents has an equal chance of being selected. For example, if you want to take a random sample of students on a campus, you would need to have a list of all the students, and then either use a random number generator or – for example- select every 10th person on the list.
This means that that everyone could be selected, and that you are not imposing some conscious or unconscious bias on the selection.
If you stand in front of the Library and just keep asking everyone until you have enough responses, or you share a survey link via social media, that is not random sampling. It is convenience sampling – you are getting responses from the people who just happen to be there on that day, and who choose to take the time to answer your questions.
There are other types of sampling: snowball, purposive, stratified, etc.