如何得到随机字符串
解决方案 »
- 建议封杀liuyuxin88这个妖孽
- 无法关闭EXCEL.EXE进程
- 有没有dephi的memo和Richedit的透明控件,
- 求DELPHI8.0的CD-KEY
- 一个很菜的问题:怎么查看所有的变量或属性值?
- OleContainer中如何打开.txt文件和.jpg文件?
- 以下Sql 语句对Sql server数据库执行成功,而对Paradox7表却不行,为什么?
- 怎样判断局域网中的某台机子不存在?
- 为什么从数据库查询的记录不对
- 难啊,高手们快来看看!救急!!!!
- 是甚麼意思?關於 ADO
- 運行時提示:[microsoft][ODBC Microsoft Access Driver]參數太少,預期個數1.是甚麼意思?
const
intMAX_PW_LEN = 10;
var
i: Byte;
s: string;
begin
{if you want to use the 'A..Z' characters}
if cbAZ.Checked then
s := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
else
s := ''; {if you want to use the 'a..z' characters}
if cbAZSmall.Checked then
s := s + 'abcdefghijklmnopqrstuvwxyz'; {if you want to use the '0..9' characters}
if cb09.Checked then
s := s + '0123456789';
if s = '' then exit; Result := '';
for i := 0 to intMAX_PW_LEN-1 do
Result := Result + s[Random(Length(s)-1)+1];
end; initialization
Randomize; 结果:
IBbfA1mVK2
tmuXIuQJV5
oNEY1cF6xB
flIUhfdIui
mxaK71dJaq
B0YTqxdaLh
...
好好学习呀!