Not random people, no, but it's a useful signal for "that person is probably contagious right now so I'll give them a wide berth".
I have got into the habit of telling people close to me, and it gives them a chance not to avoid getting a cold, but to mitigate the impact by treating the symptoms before they've really emerged.
You're probably not sniffing random people to chat them up with "you'll have a cold in 3 days", right?