Using np.random.randint

Question Q6.6.1

Explain the difference between

In [x]: a = np.array([6,6,6,7,7,7,7,7,7])
In [x]: a[np.random.randint(len(a), size=5)]
array([7, 7, 7, 6, 7])      # (for example)


In [x]: np.random.randint(6, 8, 5)
array([6, 6, 7, 7, 7])      # (for example)


To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to providing this code.