Archive

Archive for the ‘Random Number’ Category

How to generate randam string of 8 characters

April 21, 2009 Leave a comment

|start cfscript|

RPassword = “”;
// Get the random characters for password

RandomCharacters=1;

for (RandomCharacters;RandomCharacters < 8; RandomCharacters++ )
{
//character code from A To Z
ranPassword = RandRange(0097,0122);
RPassword = ListAppend(RPassword, CHR(ranPassword));
}

//Get the random numbers from 1 to 9 for password

RPassword = ListAppend(RPassword,RandRange(1,9));

//Get rid of commas

RPassword = Replace(RPassword,’,’,”, ‘all’);

|end cfscript|

Categories: ColdFusion, Random Number