NumPy没有生成随机数

时间:2020-10-08 08:48:20

标签: python-3.x numpy

我正在尝试使用numpy生成随机数,但它只会打印6和50而不是随机数

# Import Python package
import numpy as np

# Set seed
np.random.seed(123)

steps = 50

# Roll the Dice
dice = np.random.randint(1, 7)

# Control construct
if dice <= 2:
    steps = steps - 1
elif dice >= 3 and dice <= 5:
    steps = steps + 1
else:
    dice + np.random.randint(1, 7)

# Print out dice and step
print(dice)
print(steps)

0 个答案:

没有答案
相关问题