To get random entries directly from DB you should write some custom or raw queries directly to ORM.
You can search in google for: get random rows for bookshelf OR Postgres OR knex.
To avoid duplication you should store all returned IDs in the frontend then exclude them from the request to DB. But this will cause performance issues since the more data you scroll the more IDs you will have to exclude from the next request.