- Java does not provide a function to choose an element from a collection at random.
- Remember that you can retrieve an element from an array by its index, which is an integer.
- The
java.util.Random
class provides a method to generate a randomint
between 0 and a given maximum.
- The
java.util.Random
class method to generate a randomdouble
always returns a number between0.0
and1.0
.