Check out example codes for "random boolean java". It will help you in understanding the concepts better.

Code Example 1

return Math.random() < 0.5;

Code Example 2

import java.util.Random;
public class Example {
   public static void main(String[] args) {
      Random rd = new Random(); // creating Random object
      System.out.println(rd.nextBoolean()); // displaying a random boolean
   }
}

Learn ReactJs, React Native from akashmittal.com