Try this:

<cfscript>
theString = "";
for (i=0; i LT 10 ; i=i+1) {
  theNum = RandRange(48,90);
  if(theNum LTE 64 AND theNum GTE 58) {
    i=i-1;
  }else{
    theString = theString & chr(theNum);
  }
}
</cfscript>

If you have CF 5, you can make a UDF out of it:

<cfscript>
function getRandomString(theLength) {
 theString = "";
 for (i=0; i LT theLength ; i=i+1) {
   theNum = RandRange(48,90);
   if(theNum LTE 64 AND theNum GTE 58) {
     i=i-1;
   }else{
     theString = theString & chr(theNum);
   }
 }
 return theString;
}
</cfscript>

<cfoutput>#getRandomString(10)#</cfoutput>

tom
www.basic-ultradev.com

"Alex Baban" <[EMAIL PROTECTED]> wrote in message news:3b9b02ea$[EMAIL PROTECTED]...
> I am trying to generate a random string of 10 alphanumeric characters.
> Then I will set a cookie on client browser with this value. I know how to
> set the cookie but
> I need help to generate the string.
> Is there any CF function for this?
> I would appreciate any help.
> 
> Thanks in advance.
> 
> 
> --
> 
> 
> Alex Baban
> A+ Certified Computer Professional
> Phone: 604-521-8959
> Website: www.go.to/alexbaban
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to