C5_W1_A2_Ex2 "Wrong Values" error

in this assignment in sample function I am getting “Wrong Values” error.
I think, the problem is in this line

# Step 3: Sample the index of a character within the vocabulary from the probability distribution y
# (see additional hints above)
idx = np.random.choice(vocab_size,1,list(np.ravel(y)))
idx = idx[0]

Can you tell me where is the problem?
[If it does not break the community guidelines, I can share the whole function code]

Posting your code would break the community guidelines, so thanks for not posting it.

Your parameters for the call to np.random.choice(…) are not correct. Please read the instructions and example code for Step 3 carefully.

Also, what benefit does your second line of code provide?

Now I changed it, and its working…
By the way, I used

idx = idx[0]

Because, I got the idx as a 1x1 matrix.

I don’t think that’s necessary.