Re: Password Generator
- From: Nicholas Sherlock <n_sherlock@xxxxxxxxxxx>
- Date: Fri, 28 Oct 2005 07:46:06 +1300
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 .
- Follow-Ups:
- Re: Password Generator
- From: Maarten Wiltink
- Re: Password Generator
- References:
- Password Generator
- From: Ryan Styles
- Re: Password Generator
- From: Charles Appel
- Re: Password Generator
- From: Dr John Stockton
- Password Generator
- Prev by Date: Re: Password Generator
- Next by Date: Table does not reflect any changes
- Previous by thread: Re: Password Generator
- Next by thread: Re: Password Generator
- Index(es):