If your bathroom toilet keeps randomly turning on and off at irregular intervals and you have a newer style valve without a float arm and ball, it is probably time to replace the fill valve seal located under the fill valve cap.
Step 1: Purchase a new fill valve seal from your local hardware store. The Fluidmaster brand seal is perhaps the most common one and will fit most newer style fill valves.
Step 2: Use the shut-off valve to turn off the water supply to the toilet; then remove the tank lid and set it in a safe place.
Step 3: Flush the toilet to remove most of the water in the tank.
Step 4: Firmly grasp the shaft of the fill valve with one hand and grasp the cap at the top of the fill valve with the other hand.
Step 5: Use a finger or thumb to lift the short fill valve arm all the way up and turn the fill valve cap clockwise, about 1/8 of a turn.
Step 6: Release the fill valve arm and lift the cap up and off the fill valve.
Step 7: Remove the old seal from underside of the fill valve cap. If you have trouble getting the seal out, use a flathead screwdriver or a dental pick to pry the seal out.
Step 8: Once the seal has been removed, turn the cap over and hold it slightly above the top of the fill valve.
Step 9: With your free hand, reach below the stool and turn the water on for 2-3 seconds. The water should come squirting up out of the top of the fill valve and into the bottom of the cap. This will dislodge any sediment that may be stuck in the fill valve.
Step 10: Turn the water off, remove the fill valve cap and install the new seal into the bottom of the fill valve cap.
Step 11: Place the cap back on top of the fill valve and turn it counterclockwise until it snaps into place.
Step 12: Turn the water back on, replace the tank lid and flush the stool for good measure before heading off to more challenging tasks around the house.