File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Random Number from Math Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Random Number from Math" Watch "Random Number from Math" New topic

Random Number from Math

Ranch Hand

Joined: May 29, 2000
Posts: 45
Can the 'random' method of Math class return 0.0 and 1.0 ? I think, 0.0 is inclusive while 1.0 is NOT.
some one please confirm,
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Yes Shiny , that is what the documentation also says.To quote the Java2API
"Returns a random number greater than or equal to 0.0 and less than 1.0."

Joined: Jun 18, 2000
Posts: 15
Don't get me started about those stupid light bulbs.
subject: Random Number from Math