I have a function that I wrote for this very purpose.

<cfscript>
        /**
         * Returns a random hexadecimal color
         * @return Returns a string.
         * @author andy matthews ([EMAIL PROTECTED])
         * @version 1, 7/22/2005
         */

        function randomHexColor() {
                var chars = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f";
                var totalChars = 6;
                var hexCode = '';

                for ( step=1;step LTE totalChars; step = step + 1) {
                        hexCode = hexCode & 
ListGetAt(chars,RandRange(1,ListLen(chars)));
                }
                return hexCode;
        }
</cfscript>

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Ken Fused [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 06, 2006 9:47 AM
To: CF-Talk
Subject: Creating Random HEX values


I need to create random six digit Hex values for a assigning unique,
non-sequential values as IDs.

I would prefer not to use zeros.  Althought I could replace o(ohs) with
0(zeros) when the number is manually entered back into the system.

Any ideas?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237098
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to