probsoln package FAQ
This is probably because you have lots of extraneous white space in your database.
\selectrandomly will input the entire file, so any extra space will be included. Try commenting out the extra space using
As from version 3.0, you can first load the problems using
\loadselectedproblems, and then iterate through the data set using
\foreachproblem, so you may find it easier to load the problems in the preamble where the space between problem definitions won’t matter. (Spaces occurring within problem definitions will still matter.) Then in the document you can iterate through the data set.
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=prsextraspaces