Efficient way to get n random objects from

Hi,

I’m looking for an efficient way to get n random objects from a large list of objects. Currently I’m using the approach below to achieve this. Unfortunately the shuffle function is really expensive. And I could not find any examples in the docs nor in this forum or somewhere else.

val randomObjects = realm.query().find()
.shuffled().take(amount)

Has anyone an idea for the best solution? Or give me a hint to push me in the right direction?

Thank you

Marcel