---
title: "16进制随机颜色生成"
author: "wlhx"
date: "2015-02-13T09:25:59Z"
tags: ["JavaScript"]
categories: ["Web前端"]
slug: "16"
draft: false
lastmod: "2015-02-13T09:25:59Z"
id: 2185544
url: "https://wlhx.iteye.com/blog/2185544"
---

<span style="color:blue">前段时间做图表，用到了随机颜色值，虽然写了一种方法，但是不理想重复机率很大，今天在
网上看一网友博客看到的下面的方法：</span>
```js
~~(Math.random()*(1<<24))).toString(16)
```
 
<span style="color:blue">感觉挺不错的就记录了下来，和大家分享一下。</span>