I wrote a custom tag that does this:
<CF_RANDOMSTRING
LENGTH = "12"
CHARSTART = "1"
CHAREND = "z"
OUTPUTVARIABLE="myString">
generates a pseudo random string of specified length containing only
characters
found between the ascii values of CHARSTART and CHAREND
<CFPARAM NAME="Attributes.Length" DEFAULT="12">
<CFPARAM NAME="Attributes.CharStart" DEFAULT="1">
<CFPARAM NAME="Attributes.CharEnd" DEFAULT="z">
<CFPARAM NAME="Attributes.OutputVar" DEFAULT="RandomString">
<CFSCRIPT>
result = "";
for(i=1;i LT Attributes.Length;i=i+1){
result = result &
Chr(RandRange(Asc(Attributes.CharStart),Asc(Attributes.CharEnd)));
}
SetVariable("Caller.#Attributes.OutputVar#",result);
</CFSCRIPT>
P.
-----Original Message-----
From: Chris Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:38 PM
To: CF-Talk
Subject: RE: Random Password
Here's one I got off this list a while ago. Props to whoever wrote it,
because its helped me out a few times.
<cfscript>
random_word = Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ", RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
random_word = random_word & Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
RandRange(1,26), 1);
password = "#random_word##RandRange(1000,9999)#";
</cfscript>
<cfoutput>PASSWORD: <b>#password#</b></cfoutput>
it will generate a password with 7 random letter and a 4 digit number.
-----Original Message-----
From: Chris Badouin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 12:24 PM
To: CF-Talk
Subject: Random Password
All-
Sorry I am pressed for time today, but does any one have script for
generating random passwords?
CB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists