Problem in generating random colors - asp.net and c#

前端 未结 4 588
走了就别回头了
走了就别回头了 2021-02-10 04:40

I need to generate to generate random colors in Hex values in my asp.net application to draw a graph .

 Random random = new Random();
 color = String.Format(\"#         


        
4条回答
  •  臣服心动
    2021-02-10 05:12

    Random r=new Random();
    var newCol=(r.Next(0,256)<<16)+(r.Next(0,256)<<8)+(r.Next(0,256));
    

    If you want brighter colors, consider raising the minimum parameter of Next

提交回复
热议问题