Math.random() guarantees uniqueness?
(a) True
(b) False
This question was posed to me in quiz.
Enquiry is from Random Number topic in section java.util – More Utility Classes of Java
(a) True
(b) False
This question was posed to me in quiz.
Enquiry is from Random Number topic in section java.util – More Utility Classes of Java
The correct answer is (b) False
The explanation: Math.random() doesn’t guarantee uniqueness. To guarantee uniqueness we must store the generated value in the database and compare against already generated values.