학습일 : 2020.01.24
연습문제
**import** numpy **as** np
np.random.choice(np.arange(1, 46), size**=**6, replace**=False**)
Out[2]:
array([26, 6, 45, 32, 30, 33])
**def** generate_lotto_nums():
**return** np.random.choice(np.arange(1, 46), size**=**6, replace**=False**)
generate_lotto_nums()
Out[6]:
array([31, 43, 33, 20, 32, 39])
total **=** int(1e7)
points **=** np.random.rand(total, 2)
4 ***** np.sum(np.sum(points ****** 2, axis**=**1) **<** 1) **/** total
Out[7]:
3.1404064