Random function & unique random numbers

Hello, after some searching i can’t seem to find any good explanation to how and why i should use the Math.random() function so maybe i should explain how a function i need should work and someone maybe has some ideas.

I’m making a guessing program where you guess the right answer.

The function i have now randomly selects a number from 0 to 5 and then put’s these five numbers into an array, the thing is that i need the numbers to be unique and i have no idea on how to make this.

Another thing i need to do is between these numbers that the random() function gets one is to be removed and instead i put the right answer there so now i also need one of the randomizes numbers to not be the right answer.

Also, how should a Math.random() function call look like so i can edit the range of numbers to randomize from?