Fix usage of wrong vector for random index:

Fixes #10613

`free_index` is used as an index into the `free`, it should be limited by the size of that vector.