Exactly. Here's sorta how I'd imagine it working:
- You come across small camp in the middle of wasteland, consisting of two mattresses and a campfire. The camp is empty - no friendlies or hostilites in sight. You decide to sleep there. Being outdoors, there's the chance that you'll be attacked in your sleep by some random foe. If there are friendlies around though, the chance of being attacked is considerably lessened.
- You come across a shack in the wasteland. You enter the shack. The shack is empty and it doesn't look like anyone has lived here for years. There's a bed in the shack. You decide to use it to sleep. It is completely safe, carrying no risk of an attack (can be explained as the main character having locked/barricaded the door and thus, he can't be surpised by an unwelcome visitor).
- You enter a cave that turns out to be a raider hideout. You clean it out. There's some beds there. You decide to sleep there. If you do, then if it's your first time in the cave, then there's a chance that you'll be attacked by a few of the raiders pals returning.
- You enter a NCR camp. Being friendly or neutral with the NCR, it means they're willing to let you use a bed. It is completely safe.
- You enter a building. There are hostile robots in the building. You mostly clean the building out, but not completely. Seeing a bed and seeing that your sleep-meter is low, youd ecide to take a risk and sleep. Sleeping there though, means that you may be attacked by the remaining enemies that you deidn't clean out - had you cleaned it out completely, sleeping there would've been perfectly safe.
- You enter New Vegas. You decide to use a hotel there. Using the hotel is completely safe and carries no risk whatsoever of an attack (unless maybe quest/story-related)?
- You enter a cave. It turns out to be a Yao Guai lair. The lair has some mattresses in it. If you have the Animal Friend Perk, then the Yao Guai are your bestet pals and thus it's safe to sleep there. However, if you don't have it, clean the cave out instead and then sleep there, then there's a chance that you'll be attacked by a Yao Guai returning from a hunt...
Having companions with you would also lessen the chance of being surpised in your sleep - after all,attacking more thna a single person (the player) would be seen as more risky for any would-be attackers...
