This has been asked before (in almost exactly the same way! '15 mins' may well be the best search term to find that.)
Short answer: this feature does not exist in standard Moodle. It should be possible for someone to create a new Quiz access rule plugin, for this.