| Author |
Math.random VS random.nextDouble
|
Ronnie Phelps
Ranch Hand
Joined: Mar 12, 2001
Posts: 329
|
|
|
What are the advantages, if any, of using the Random class to return a random number over using the Math class?
|
 |
Chad McGowan
Ranch Hand
Joined: May 10, 2001
Posts: 265
|
|
Look at the last couple of posts in this link. I tested both and found the Random class to be faster. http://www.javaranch.com/ubb/Forum34/HTML/001112.html
|
 |
Daniel Searson
Ranch Hand
Joined: Dec 03, 2000
Posts: 83
|
|
|
From memory, I have looked at the source code for the Math class and seen that it uses a Random object to produce its values. This may be wrong in different versions of Java though.
|
- Daniel
|
 |
 |
|
|
subject: Math.random VS random.nextDouble
|
|
|