Vote Course 5, Week 1, A2, Sample function exercise

Hi!
I am getting the following weird message, that I don’t quite understand:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-8-a13d660e654a> in <module>
     19     print("\033[92mAll tests passed!")
     20 
---> 21 sample_test(sample)

<ipython-input-8-a13d660e654a> in sample_test(target)
      7 
      8 
----> 9     indices = target(parameters, char_to_ix, 0)
     10     print("Sampling:")
     11     print("list of sampled indices:\n", indices)

<ipython-input-7-a36f898f3912> in sample(parameters, char_to_ix, seed)
     61         # (see additional hints above)
     62 
---> 63         idx = np.random.choice(range(len(y),vocab_size), p = y.ravel())
     64 
     65         # Append the index to "indices"

mtrand.pyx in numpy.random.mtrand.RandomState.choice()

ValueError: 'a' cannot be empty unless no samples are taken

I believe that what that error message means is that the first argument to the “choice()” function there is 0 length. You are giving two arguments to “range”, so that means the first one is the start and the second one is the end. But those two values should be equal, right? So that means you end up with an empty range. That doesn’t seem like what you want.