If you want to get the specific range of values the you have to multiple the retruned value with the magnitue of the range. Unlike some of the numeric methods of class StrictMath all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results. 1 int x 1 int Mathrandom 10.
This unique number is of type Double which is greater than 00 and less than 10.
The javalangMathrandom method returns a pseudorandom double type number greater than or equal to 00 and less than 10. By default Mathrandom always generates numbers between 00 to 10 but if we want to get numbers within a specific range then we have to multiple the return value with the magnitude of the range. Returned values are chosen pseudorandomly with approximately uniform distribution from that range. Another way to generate a random number is to use the Java Random class of the javautil package.