I do not know about picking only 4 out of 12 possible answers. If truly random, this introduces the potential for it to randomly pick 4 incorrect answers, preventing the student from even getting the question correct. A possible solution would be to have multiple correct answers out of the 12 options, but then you also run into the situation where students could randomly draw multiple correct options to select.
Another possible solution would be to create an item bank with multiple similar questions. As a math example, imagine 10 different math equations that are all similarly testing single digit multiplication. The quiz randomly pulls 5 questions. Each student may get different questions than the person next to them, making it harder to cheat, but because they are all similar in design, you can reliably evaluation student mastery of single digit multiplication.
With multiple choice, you can randomize the order of the questions, but I'm not sure you can randomly pull from a pool of answers.