The * unpacks a tuple into multiple input arguments. The code is creating a random matrix the same shape as H1 using the shape attribute (which is a tuple) as the dimension inputs to np.random.rand.
You can do this with any tuple
np.random.rand(*(2,3)) # The same as np.random.rand(2,3)
# Creates a 2 x 3 array
You are trying to unpack an integer which is going to fail.