import numpy as np
# Create rain data
n_drops = 10
rain_drops = np.zeros(n_drops, dtype=[('position', float, (2,)),
('size', float),
('growth', float),
('color', float, (4,))])
# Initialize the raindrops in random positions and with
# random growth rates.
rain_drops['position'] = np.random.uniform(0, 1, (n_drops, 2))
rain_drops['growth'] = np.random.uniform(50, 200, n_drops)
print(rain_drops)
"""
result:
[([0.70284885, 0.03590322], 0., 176.4511602 , [0., 0., 0., 0.])
([0.60838294, 0.49185854], 0., 60.51037667, [0., 0., 0., 0.])
([0.86525398, 0.65607663], 0., 168.00795695, [0., 0., 0., 0.])
([0.25812877, 0.14484747], 0., 80.17753717, [0., 0., 0., 0.])
([0.66021716, 0.90449213], 0., 121.94125106, [0., 0., 0., 0.])
([0.88306332, 0.51074725], 0., 92.4377108 , [0., 0., 0., 0.])
([0.68916433, 0.89543162], 0., 90.77596431, [0., 0., 0., 0.])
([0.7105655 , 0.68628326], 0., 144.88783652, [0., 0., 0., 0.])
([0.6894679 , 0.90203559], 0., 167.40736266, [0., 0., 0., 0.])
([0.92558218, 0.34232054], 0., 93.48654986, [0., 0., 0., 0.])]
"""