Is there an easy way to query random data by SwiftData order?

TBH I am not familiar with SwiftData at all, but it seems to me that fetchOffset and fetchLimit are your friends. You can set fetchLimit to 1 and fetchOffset to a random value within a range of number of ummm... models? in ummm... what? I mean records in the table.

I would say this is a bad practice when working with databases in general. The amount of fetched data may occur way larger than available amount of RAM.

1 Like

OMG, you are genius, why didn't I think of it.
Thank you so much!