Using np.random.randint to sample from a set of evenly-spaced reals

Question Q6.7.2

In Example E6.16 we used random.random_integers to sample from the uniform distribution on the floating point numbers $[\frac{1}{2}, \frac{3}{2}, \frac{5}{2}, \frac{7}{2}]$. How can you do the same using the random.randint instead?


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.