Element not found for associative array index in constraint

Solution 1:

Calling randomize cannot modify the size of an associative array or any of its index keys. The indexes of an associative array are not necessarily consecutive. That is why people sometimes call them sparse arrays. Perhaps you should use a dynamic array instead.