Fix a bug with the selectRandomly selector

I found this while trying to create custom algo XML.
I did not try this fix in my project, but all the project test cases are green.