

You may have a combination lock on your locker at school where you have to spin the dial to 3 separate numbers from 0 up to 40. These are all listed in the AP CS A Java Quick Reference Sheet that you can use during the exam. Int abs(int) : Returns the absolute value of an int value (which is the value of a number without its sign, for example Math.abs(-4) = 4).ĭouble abs(double) : Returns the absolute value of a double value.ĭouble pow(double, double) : Returns the value of the first parameter raised to the power of the second parameter.ĭouble sqrt(double) : Returns the positive square root of a double value.ĭouble random() : Returns a double value greater than or equal to 0.0 and less than 1.0 (not including 1.0!). Other Math functions that you can use are: Remember that you can compute the range you need with (max number - min number + 1).

Yes, (int)(Math.random()*36) + 25 moves the random number into a range of 36 numbers starting from a minimum number 25 up to 60.We want the minimum number to be 25, but the minimum number here would be 60. Remember that (int)(Math.random()*range) + min moves the random number into a range starting from a minimum number.

We want the minimum number to be 25, but the minimum number here would be 36. 2-9-7: Which of the following statements assigns a random integer between 25 and 60, inclusive, to rn?
