Returns a double greater than or equal to 0.0 and less than 1.0 .
Output is a double.
Output will be 0.7, different each time we run the above code.

Random number over a range of Numbers

We can specify a range, say 100 to 200 and get random numbers between them.
int max=200, min=100;
System.out.println((int) (Math.random() * (max-min)+1)+min);
All Math functions


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer