linux系统产生随机数的6中方法
来源:互联网 发布:java 用模板导出excel 编辑:程序博客网 时间:2024/06/05 19:28
linux系统产生随机数的6种方法
[root@i-1pbhgm8j ~]# echo $RANDOM | md5sum | cut -c 5-11
3edb8e2
2、通过openssl产生随机数
[root@i-1pbhgm8j ~]# openssl rand -base64 30
K2M6kqd//nWnOcn0l+jZdQPLhojKwuiqKJmZjj5H
小结:这里后面的数字30是产生随机数的位数
3、通过时间data产生随机数
[root@i-1pbhgm8j ~]# date +%s%N
1507534201869428907
4、通过/dev/urandom配合chksum生成随机数
[root@i-1pbhgm8j ~]# head /dev/urandom | cksum
3529852297 1731
5、通过UUID生成产生随机数
[root@i-1pbhgm8j ~]# cat /proc/sys/kernel/random/uuid
1a2f4db2-5ec6-46b1-8c08-f0fdf17e76eb
[root@i-1pbhgm8j ~]# cat /proc/sys/kernel/random/uuid
6c2be32b-6f8c-4cdc-9f6f-224a3d966f7a
[root@i-1pbhgm8j ~]# cat /proc/sys/kernel/random/uuid
4a11c9e6-0b42-4401-bad3-f492dcb28baa
6、使用expect附带的mkpasswd生成随机数
[root@i-1pbhgm8j ~]# yum install expect -y
[root@i-1pbhgm8j ~]# mkpasswd -l 10 -d 4 -c 2 -C 2 -s 1
y78UF/o93b
[root@i-1pbhgm8j ~]# mkpasswd -l 10 -d 4 -c 2 -C 2 -s 1
hELs1(n297
[root@i-1pbhgm8j ~]# mkpasswd -l 10 -d 4 -c 2 -C 2 -s 1
gWC$s1239z
小结:
-l 指定密码长度
-d 指定密码中数字的数量
-c 指定密码中小写字母的数量
-C 指定密码中大写字母的数量
-s 指定密码中特殊字符的数量
阅读全文
0 0
- linux系统产生随机数的6中方法
- linux系统产生随机数的方法
- linux qt,产生随机数的一种方法
- java中产生随机数的方法
- linux_shell 中,产生随机数的方法
- java中产生随机数的两个方法
- C语言中产生随机数的方法
- C语言中产生随机数的方法
- java中产生随机数的方法
- Java中产生随机数的两个方法
- Java中产生随机数的方法
- Java中产生随机数的两个方法
- shell中产生随机数的方法
- java中产生随机数的方法
- Node.js 中产生随机数的方法
- Verilog语言中产生随机数的方法
- Java中产生随机数的方法总结
- java中产生随机数的方法
- 【python web】Flask+Echarts 实现动图图表
- 模板的包含、继承、重写
- leetcode 169|229. Majority Element 1|2
- linux下安装mysql可视化工具workbench
- 文因互联CEO鲍捷:做聊天机器人有哪些坑?
- linux系统产生随机数的6中方法
- 编译原理(一) Chomsky文法
- springboot + redis集群实现session共享
- ssh整合
- SpringBoot整合swagger
- 写代码过程中的冗余处理
- C++中各种数据成员及成员函数的定义及使用
- Game Plug-ins(3)
- pc端支付宝扫码支付