random模块

 

 

注:random.random:随机取一个数值。

注:random.randint(范围,范围):随机取范围内的值。

注:random.randrange(范围,范围):随机取值如1-3就不包含3,与range相同。

注:random.choice(“[]”):在一组列表,字符串,或元组,中随机取值

注:random.sample("ABCD","数字个数"):随机取定义位数,一列表打印,可取字符串,列表元组

注:random.uniform(范围,范围):随机取范围内的数字,包含浮点数。

注:random.shuffle(顺序数字):打乱一段传入的顺序数字。

相关文章:

  • 2021-11-20
  • 2021-08-05
  • 2022-01-12
  • 2021-11-14
猜你喜欢
  • 2021-06-19
  • 2021-08-15
  • 2021-09-02
  • 2022-01-05
相关资源
相似解决方案