import numpy as np
np.random.seed(seed=42)
np.zeros
a = np.zeros(2)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.zeros((2, 3))
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.zeros((2, 3, 4))
print(f"c.shape = {c.shape} \nc =\n{c}\n")
np.ones
a = np.ones(2)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.ones((2, 3))
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.ones((2, 3, 4))
print(f"c.shape = {c.shape} \nc =\n{c}\n")
np.full
a = np.full(2, 3.14)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.full((2, 3), 3.14)
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.full((2, 3, 4), 3.14)
print(f"c.shape = {c.shape} \nc =\n{c}\n")
random.rand
a = np.random.rand(2)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.random.rand(2, 3)
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.random.rand(2, 3, 4)
print(f"c.shape = {c.shape} \nc =\n{c}\n")
a = np.random.random(2)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.random.rand(2, 3)
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.random.random([2, 3, 4])
print(f"c.shape = {c.shape} \nc =\n{c}\n")
random.randint
# 0 以上 10 未満
a = np.random.randint(0, 10, (2))
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.random.randint(0, 10, (2, 3))
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.random.randint(0, 10, (2, 3, 4))
print(f"c.shape = {c.shape} \nc =\n{c}\n")
np.arange
a = np.arange(10)
print(f"a.shape = {a.shape} \na = {a}\n")
b = np.arange(0, 20, 2)
print(f"b.shape = {b.shape} \nb =\n{b}\n")
c = np.arange(1, 10).reshape((3, 3))
print(f"c.shape = {c.shape} \nc =\n{c}\n")