Answer the question
In order to leave comments, you need to log in
How to select a random entry by id if the service API does not provide such an opportunity?
A request for a record is made by the id of this record.
Hardcore variant
For example, example.com/post/4r8df15jfe8
. I need to select a random entry from all existing ones. In this case, id is a random sequence of characters, and id does not have any strict order. How to be in that case?
Light version
Recordings receive their id in the order they are added to the database. Therefore id can have a value from 1 to infinity. Here you can choose a random number in the range, and make a request for this number. But it is not clear, in the range from 1 to how much? Entries are added frequently and the range is constantly expanding. How in that case to learn id of the most recent record?
As an example , the unofficial api of Kinopoisk
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question