Distraction can be a good thing for learning under the right circumstances—namely when you will be tested or have to perform under similarly distracting contexts.

Psychologists know that the things we learn in one context might not be remembered in another. Famously, investigators once showed that words learned while scuba diving are easier to recall underwater than on dry land. Now Brown University psychologists suggest something similar happens with distraction. The researchers trained 48 people to hit a computer-screen target using a wonky touch pad—tracing up, for example, might move the cursor diagonally—and later evaluated them on their ability to quickly hit the mark. During both training and the test, participants were randomly selected to do a distracting second task: counting letters on a screen. Those distracted during just one phase performed poorly when tested, but those who had done the letter-counting task during both training and testing performed just as well as those who had trained and been tested without distractions, according to the results published in February in Psychological Science.

The consensus remains that distraction is typically bad for learning, the scientists explain. But if you anticipate a distracting testing or performance environment, try to mimic those distractions as you study or practice to avoid being caught off guard.