admin/environment/custom check/question random check
From MoodleDocs
Random Questions that select from subcategories that have a different 'shared' status from their parent categories may have their sharing status changed in unexpected ways. See the documentation on Question Engine Changes in Moodle 1.9 that affect Random Questions selecting from subcategories for details.