A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Math.random VS random.nextDouble
Joined: Mar 12, 2001
Jul 23, 2001 17:13:00
What are the advantages, if any, of using the Random class to return a random number over using the Math class?
Joined: May 10, 2001
Jul 25, 2001 11:02:00
Look at the last couple of posts in this link. I tested both and found the Random class to be faster.
Joined: Dec 03, 2000
Jul 26, 2001 19:00:00
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.
subject: Math.random VS random.nextDouble
what is a cookie when locking?
Creating a Random Number..
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014