E10002 String Errors

sample-count-exceeds-array

sample count exceeds array length

When this occurs

random.sample() called with n greater than array length

Example error message

error[E10002]: random.sample(): cannot sample 10 elements from array of length 5

How to fix

Ensure the sample count is less than or equal to the array length. Use `len(arr)` to check the array size first.

Related errors