Re: Password Generator



Dr John Stockton wrote:
const S =
   'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

function Password( NumChars: integer): string;
var CharCount: integer;
begin result := '';
  for CharCount := 1 to NumChars do result := result + S[random(62)+1];
  end;

may suffice.

Small change:

const S =
   'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

function Password( NumChars: integer): string;
var CharCount: integer;
begin result := '';
for CharCount := 1 to NumChars do result := result + S[random(length(s))+1];
end;


This way you can add more characters to your string without having to count them up :).

Cheers,
Nicholas Sherlock
.