I would like to retrieve random item from SharePoint list.
I have these approaches:
- Get random index and use
list.items[randomIndex]. But I think that I retrieves all items from DB in this case.
- Create query to retrieve all ids from list, then select random id and use
- Get last record id, select random value from 0 to this id, try to get item by selected value. If an item does not exist, repeat steps.
How can I do this in the best way? Your solutions?