A method for generating random numbers

Generating a random number of offense; 
1) using the encryption system variable $ RANDOM 0-32767 bad, using the number of bits required md5sum taken and
echo "$ the RANDOM" | md5sum | Cut -C 1-8
2) a random number generated by openssl
RAND -base64. 8 OpenSSL
. 3) DATE random number obtained by the time 
date +% s% N% s starting from the current system to the linux seconds,% N nanoseconds
4) by generating a random number UUID
UUID Universally unique identifier called the ( Universally Unique Identifier, UUID)
is a software standard construction, is also the free software Foundation Open software Foundation OSF
part of the organization in a distributed computing environment distributed Computin environment DCE field

    cat /proc/sys/kernel/random/uuid
5)expect附带的mkpasswd生成
    mkpasswd命令依赖于expect 必须安装

    mkpasswd -l 9 -d 2 -c 3 -C 3 -s 1
    -l 指定密码长度   默认为9   length
    -d 指定密码中的数字数量 默认为2 digits -c 指定密码中小写字母的数量 默认为2 lowercase chars -C 指定密码中大写字母的数量 默认为2 upper chars -s 指定密码中的特殊字符数量 默认为1 special chars 以上都必须有

Guess you like

Origin www.cnblogs.com/betterquan/p/11369135.html