Hi! I have a question regarding the random articles generation in the API. Let's say I'm using this URL to retrieve two random articles:
https://en.wikipedia.org/w/api.php?format=xml&action=query&generator...
I got an API response which contains articles A and B in this order: 1. A 2. B
Is there a chance (I know it's very small, but it's just for my understanding), that I'll get the exact articles but in the opposite order? Like this: 1. B 2. A
I'd like to know whether there is certain order for the random articles in the API response, or it's also random.
Thanks!
On Sunday, March 18, 2018, Tal Barda 412tal412@gmail.com wrote:
Hi! I have a question regarding the random articles generation in the API. Let's say I'm using this URL to retrieve two random articles:
https://en.wikipedia.org/w/api.php?format=xml&action=query&generator...
I got an API response which contains articles A and B in this order:
- A
- B
Is there a chance (I know it's very small, but it's just for my
understanding), that I'll get the exact articles but in the opposite order? Like this:
- B
- A
I'd like to know whether there is certain order for the random articles
in the API response, or it's also random.
Thanks!
Only if there is only 2 articles in wiki.
There is a deterministic "random" order of pages (on creation, each page is associated with a random number). The random api module picks a random place in this ordering to start, and then returns results in order of their random number.
-- brian
If I recall correctly the "randomness" is predetermined and you are always going to pull from the same list order but in random location on said list. This is from memory so take it with a grain of salt
On Sun, Mar 18, 2018 at 4:55 PM Tal Barda 412tal412@gmail.com wrote:
Hi! I have a question regarding the random articles generation in the API. Let's say I'm using this URL to retrieve two random articles:
https://en.wikipedia.org/w/api.php?format=xml&action=query&generator...
I got an API response which contains articles A and B in this order:
- A
- B
Is there a chance (I know it's very small, but it's just for my understanding), that I'll get the exact articles but in the opposite order? Like this:
- B
- A
I'd like to know whether there is certain order for the random articles in the API response, or it's also random.
Thanks!
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
As mentioned, the order of the random articles should be stable... Assuming that there are no changes on the wiki affecting that. Article creations, deletions, etc. means that the articles on your list could disappear, and reappear somewhere else, as well as new ones appearing between them. As an extreme example, if you renamed each page to the title of the other, you would get a list of the same articles in the opposite order.
Best regards
mediawiki-api@lists.wikimedia.org