Math.random()

A method that returns a pseudorandom double from 0.0 up to, but not including, 1.0.

What does Math.random() do in Java?

Math.random() — A method that returns a pseudorandom double from 0.0 up to, but not including, 1.0.

class PriceCalculator {
    long roundedPrice(double price) {
        return Math.round(price);
    }
}

Level: Apprentice · More Java terms at this level

Updated

In other subjects