"Random Article" Feature on wikipedia.com

random, wiki

Solution

Here's information on that.

Every article is assigned a random number between 0 and 1 when it is created (these are indexed in SQL, which is what makes selection fast). When you click random article it generates a target random number and then returns the article whose recorded random number is closest to this target.

If you are interested you can read the actual code here.

Problem

i would like to know what algorithm and what programming language wikipedia is using to randomly choose an article to display. i would also like to know how does it work so fast?

Original source