Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random ASCII String Generator

Status
Not open for further replies.

JonnyW

Technical User
Feb 24, 2005
2
GB
I am trying to find some code which will allow me to generate a RANDOM string of characters. I am really aiming to write a password generator but cannot find how to create a RANDOM string generator...

ANY help would be great and very much appreciated.

 

Did you look in the Delphi help file for the RANDOM function?

 
Try something like this:

function RandString(const stringsize: integer): string;
var
n: integer;
s: string;
const ss: string = '0123456789abc';
{list all the charcaters you want to use}
begin
s:='';
for n:=1 to stringsize do
s:=s+ss[random(length(ss))+1];
RandString:=s;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top