Home > ColdFusion, Random Number > How to generate randam string of 8 characters

How to generate randam string of 8 characters

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

Advertisements
Categories: ColdFusion, Random Number
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: