Hi Jessica, What you could do is creating a non persistable (search) entity with a reference to the Category entity.
Pressing the button should create the search object and open a pop up page. Via a reference selector, you will be able to select a category. In this pop up page, you can add a button that has a similar logic as your Random selection, but you now include the selected category object in your query.
Hope this helps.