When guys give their number instead of taking yours?

I was on my way to university and this guy sitting across kept checking me out which slowly moved onto touching my leg with his (creepy I know right!) Anyway he finally got the guts to initiate a conversation and then gave me his number before getting of at his station. I told my friend and we were laughing about it and she said that fact that he gave me his number instead of asking for mine meant he probably thought he had no chance with me and that if he had asked my number I would've said no. Needless to say I deleted that guys number as soon as he gave it to me as I wasn't interest but thought it would be rude to not take his number. So is my friend right in saying when a guy gives you his number instead of asking for yours does that mean he doesn't have much confident and assumes you would reject giving him your number?
When guys give their number instead of taking yours?
Post Opinion