# Random color with certain range noob style :)

**URL:** <https://forum.kirupa.com/t/random-color-with-certain-range-noob-style/289029>\
**Category:** Uncategorized\
**Created:** [May 25, 2009, 10:36am UTC](https://forum.kirupa.com/t/random-color-with-certain-range-noob-style/289029 "2009-05-25T10:36:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![werehunt](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@werehunt](https://forum.kirupa.com/u/werehunt)\
**Post date:** [May 25, 2009, 10:36am UTC](https://forum.kirupa.com/t/random-color-with-certain-range-noob-style/289029/1 "2009-05-25T10:36:36Z")

</div>

I am trying to exclude dark(er) colors, not sure this is the right way, but its the best with my level of knowledge 😃

```auto
var color:uint = (Math.floor(Math.random() * 0xFFFFFF));
function randomColor(color:uint):uint {
    if ((color).toString(16) < 0x333333) {//I am getting an error if I try this
        return color;
    }
}
randomColor(color);
trace((color).toString(16));

```

ofcourse, I appreciate any advice concering better coding of random color 😛
