# Limiting random colours

**URL:** <https://forum.kirupa.com/t/limiting-random-colours/155496>\
**Category:** flash\
**Created:** [July 18, 2005, 11:17am UTC](https://forum.kirupa.com/t/limiting-random-colours/155496 "2005-07-18T11:17:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shutdown](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@shutdown](https://forum.kirupa.com/u/shutdown)\
**Post date:** [July 18, 2005, 11:17am UTC](https://forum.kirupa.com/t/limiting-random-colours/155496/1 "2005-07-18T11:17:28Z")

</div>

Hello,  
I have the random colouring script from here:

myColor = Math.round( Math.random()\*0xFFFFFF );  
myColoredObject = new Color (\_root.square);  
myColoredObject.setRGB(myColor);

Is there a way to adapt this so it limits the colours? For example it only has 10 colours to choose from but still loads them randomly?
