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

Code Example 1

Random rand = new Random();
    // Java 'Color' class takes 3 floats, from 0 to 1.
    float r = rand.nextFloat();
    float g = rand.nextFloat();
    float b = rand.nextFloat();
    Color randomColor = new Color(r, g, b);

Learn ReactJs, React Native from