RE: Creating Random HEX values
random and unique are mutually exclusive. -Original Message- From: Ken Fused [mailto:[EMAIL PROTECTED] Sent: Thursday, April 06, 2006 10: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:237097 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
RE: Creating Random HEX values
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
Re: Creating Random HEX values
Looking at this, though, I don't see any indication that randomness is guaranteed which might become a problem if these values are being used for IDs. Ken, is there any reason you can't just use a UUID? On 4/6/06, Andy Matthews [EMAIL PROTECTED] wrote: 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:237099 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=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Creating Random HEX values
Yes, initially they are. However, I will be checking the randomly created number against the DB to ensure it is not already in use. random and unique are mutually exclusive. -Original Message- From: Ken Fused [mailto:[EMAIL PROTECTED] Sent: Thursday, April 06, 2006 10: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:237100 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
RE: Creating Random HEX values
Well, I correct my original statement. I didn't intend for this to be used as a login or user id, but literally as a random hex value: http://www.andyandjaime.com/uploads/am.cfm !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Rob Wilkerson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 06, 2006 10:02 AM To: CF-Talk Subject: Re: Creating Random HEX values Looking at this, though, I don't see any indication that randomness is guaranteed which might become a problem if these values are being used for IDs. Ken, is there any reason you can't just use a UUID? On 4/6/06, Andy Matthews [EMAIL PROTECTED] wrote: 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:237102 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
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:237104 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
RE: Creating Random HEX values
This project sounds awesome, and I'm glad to see that there truly are people out there that care about their kids (or even care to /have/ kids, for that matter). :D -Original Message- From: Ken Fused [mailto:[EMAIL PROTECTED] Sent: Thursday, April 06, 2006 9:33 AM 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. This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A1. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237107 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=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Creating Random HEX values
What a cool project. On 4/6/06, Ken Fused [EMAIL PROTECTED] wrote: 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:237109 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
RE: Creating Random HEX values
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