sure, the recordset will be returning more rows than it needs to but there is not another to offer a random selection.
the work flow is this:
the reordset is created and the page displays the add to cart button to the user, code at the end of the page destroys the recordset result set.
the user clicks the add to cart button which posts a form
the page relaods, creates the recordset, triggers the code to add the item to the cart which looks at the ID passed in and tries to find that record in the recordset results.
By using ORDER BY rand() LIMIT 0, 5 the recordset result used to create the page at first will not be the same as the results set when the add to cart button posts.