Its basically luck. Like it was stated earlier. If everything is properly working, you should get a hard on several times a night. When you are coming out of your deep sleep in the morning your body has the tendency to realize you have a hard on..subconsiously...and you wake up.
Want to do i test if you dont wake up with a hard on. Get a strip of stamps..or if your hung like a bull...two strips...and wrap them around your penis...you should wake up in the morning and see the stamps are torn appart.
Everytime i sleep, even a power nap i wake with wood! I thought as i got older this would go away but hell no i'm 36 and still pop wood like a teenage boy with a hustler magizine.