Programmer's Wiki
Advertisement

java.lang.Math is a library in Java containing several math related functions. It is contained inside the java.lang library and therefore is imported into any java program automatically.

Math.random[]

Java's Math.random() function generates and returns a pseudorandom number between 0 and 1. It takes no parameters.

Math.round[]

Returns the variable used as its parameter as a rounded number containing no decimals.J

Advertisement