This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Random Number from Math" Watch "Random Number from Math" New topic
Author

Random Number from Math

Shiny
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,
thanks
Anonymous
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."
mmkris_1
Greenhorn

Joined: Jun 18, 2000
Posts: 15
[0,1)
 
 
subject: Random Number from Math
 
Similar Threads
Generating Random Number
greater than or less than symbols
Math.round() duffulty
Random method
extremes of Math.ceil