How awesome is that?!?! Great idea Ken. Let us know how it works.

<!----------------//------
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 10:33 AM
To: CF-Talk
Subject: Re: Creating Random HEX values


Thank you

Andy this works great. Thank you.

I removed the 0 and now I get random 6 digit hex values that do not contain
Zeros. As the numbers are generated I'll check them against the values that
exist in the DB before adding them to the db to ensure uniqueness.


I could have used UUID, but the length was overkill. I could have used
listfirst() and pulled the first 8 characters and had it not been for Andy's
solution I would have gone that way. So thank you form bringing up the use
of UUID.

This will be used for a project for my 5 year old daughter (ok at daddy's
urging).  Today is her birthday.  I have rented a helium tank for a year.
Everyday we are going to launch balloons with a plastic easter egg attached
to them.

Inside the egg will be a laminated piece of paper with the 6 digit
registration number, a website address and directions to register when and
where the balloon was found.

The registration number will be used as a unique id to tie the found data
with the launch informaiton, when the balloon was launched, where, time of
day, weather conditions, wind information, etc...

It will be fun for her to make meet other people and see were they live in
comparison to where the balloon was launched.  Initially for her it will be
about people finding her balloons and making friends.

I wouldn't mind keeping this up for god only knows how long. Then as she
gets into science classes etc.. she can use the data for school projects...

I am hoping to use google maps to show the locations of where the balloons
were launched and found.  But I've not started on the piece yet.




>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:237110
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