python关于随机数的方法

1、指定范围的浮点数:random.uniform(1, 100)

2、指定小数位数进行四舍五入:random.uniform(1, 100), 7

3、string中的随机字符串:

 4、由指定集合中的元素生成指定位数不重复的列表:random.sample(string.hexdigits, +4)

原文地址:https://www.cnblogs.com/canghai1024/p/13846832.html