Did you run the query I suggested and what was the result of it?
SELECT count(*) as NumerOfRandomQuestions from yourprefix_question where id in (SELECT q.id FROM yourprefix_question AS q LEFT JOIN _quiz_slots AS qslots ON q.id = qslots.questionid WHERE qslots.questionid IS NULL AND q.qtype = 'random');
*yourprefix is your moodle table's prefix name