Yes. Use the nextBoolean() method, described below,
or use nextInt(2).
Random Methods
Here are some more methods of the Random class:
long nextLong()— Returns a pseudorandom, uniformly distributedlongvalue.
All possiblelongvalues, both positive and negative, are in the range of values returned.
boolean nextBoolean()
— Returns a pseudorandom boolean value.
void setSeed(long seed)— sets the seed of the random number generator.
This might be done in several places in a program so that different objects are tested against
the same random events.
There are some other methods of Random not described here.
Think of a really great secret password for your computer account.