Randint() in C1_W3_Assignment

In C1_W3_Lab_2_extract_a_sub_section,

# Choose a random start index, note the np.random.randint() function excludes the upper bound.
start_i = np.random.randint(image_length - patch_length + 1)

However, this seems inconsistent with the python documentation. I struggled with the assessment because I was following the python the documentation, not the example.

Thanks -

Richard

1 Like

Looks like Python randint() and numpy randint() behave differently at the upper bound. You linked to the native Python doc but your code uses numpy,

https://numpy.org/doc/stable/reference/random/generated/numpy.random.randint.html

2 Likes

Thanks, that makes sense!