Testing · Junior · Question 40 of 78

How do you make a test that uses Math.random() deterministic?

Explanation

Random values, current time and network are the usual sources of non-determinism. Fix them in tests.

Further reading

Problem with a question

Testing · Junior · question 40

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz