PDA

View Full Version : random()


purdueCSjason
11-11-2002, 06:25 AM
What data type does random() return? It says in my book that it returns a number between 0 and 1, but it doesn't specify a data type.

phubuh
11-11-2002, 06:51 AM
random()? What's that?

Whatever it is, the Java API documentation at http://java.sun.com/ will tell you everything about it.

sans-hubris
11-11-2002, 11:13 AM
http://java.sun.com/j2se/1.3/docs/api/java/lang/Math.html#random()

ChefNinja
11-11-2002, 05:30 PM
double

Dru Lee Parsec
11-12-2002, 12:37 PM
You can also use java.util.Random and use the nextInt, nextLong, nextByte etc to get any data type you need.

darelf
11-12-2002, 02:15 PM
It's inspiring to see versions of "rtfm" still surviving to this day.

Back before I knew what the Internet was, my teachers/parents wouldn't tell me what a word meant. They always made me look it up in the dictionary. A habit that has served me well to the current day.

(Except for the me-being-a-loser part... it didn't help with that)