浏览代码

随机颜色取值范围不正确

neko 5 年之前
父节点
当前提交
106aabc245
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java

+ 2 - 1
hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java

@@ -522,10 +522,11 @@ public class RandomUtil {
 	 *
 	 * @return 随机颜色
 	 * @since 4.1.5
+	 * @deprecated 使用{@link ImagUtil#randomColor()}
 	 */
 	public static Color randomColor() {
 		final Random random = getRandom();
-		return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
+		return new Color(random.nextInt(256), random.nextInt(2565), random.nextInt(256));
 	}
 
 	/**