Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 1.03 KB

day19.md

File metadata and controls

32 lines (28 loc) · 1.03 KB

第十九天

索引

python标准库 random

  1. random random.random
import random

for i in range(5):
    print('%04.3f' % random.random(), end=' ')
print()
  1. random.uniform
import random

for i in range(5):
    print('{:04.3f}'.format(random.uniform(1, 100)), end=' ')
print()
  1. random.seed(2) 种子一样生成的值就一样
  2. random.choice()接收个可迭代对象
  3. random.shuffle()
  4. random.sample() 不包含重复的c