I have tried this question so many different ways and I keep getting an error that says “Do not call Math.random() in this course. Instead use…