creating random color in java

Solutions on MaxInterview for creating random color in java by the best coders in the world

showing results for - "creating random color in java"
Salvatore
16 May 2019
1Random rand = new Random();
2    // Java 'Color' class takes 3 floats, from 0 to 1.
3    float r = rand.nextFloat();
4    float g = rand.nextFloat();
5    float b = rand.nextFloat();
6    Color randomColor = new Color(r, g, b);