Code example for Random

Methods: nextFloat

0
  @Nonnull 
  private Color getDebugColor() {
    if (debugColor != null) {
      return debugColor;
    } 
    final Random rnd = new Random();
    debugColor = new Color(rnd.nextFloat(), rnd.nextFloat(), rnd.nextFloat(), .5f);
    return debugColor;
  } 
 
  /** 
   * set a background color. 
   * 
   * @param newBackgroundColor background color 
   */ 
  public void setBackgroundColor(@Nullable final Color newBackgroundColor) {
    this.backgroundColor = newBackgroundColor;
  } 
} 
Experience pair programming with AI  Get Codota for Java