Rebound Sex: Friend or Foe?

So, my boyfriend and I broke up almost a month ago. We were very serious (living together, had gone ring shopping, etc. ), but we haven't hardly spoken at all since the break up. Is having random sex with a friend a bad idea or is it ok? I do miss my ex, but I'm giving up on the fact of him coming back. Is my rebound sex warranted?