Re: Random Light Color Picker

From NAT, 7 Years ago, written in JavaScript, viewed 790 times. This paste is a reply to Random Light Color Picker from NAT - view diff
URL https://code.nat.moe/view/1c2194e6 Embed
Download Paste or View Raw
  1. function getRandomColor() {
  2.                 ranges = [
  3.                     [100,250],
  4.                     [100,170],
  5.                     [200,250]
  6.                 ];
  7.             var g = function() {
  8.                 //select random range and remove
  9.                 var range = ranges.splice(Math.floor(Math.random()*ranges.length), 1)[0];
  10.                 //pick a random number from within the range
  11.                 return Math.floor(Math.random() * (range[1] - range[0])) + range[0];
  12.             }
  13.             return "rgb(" + g() + "," + g() + "," + g() +")";
  14.         };
  15. //Without CGI echo

Reply to "Re: Random Light Color Picker"

Here you can reply to the paste above

captcha