我想知道维基百科使用什么算法和编程语言来随机选择要显示的文章。
我也想知道它是如何工作得这么快的?
最佳答案
Here's 相关信息。
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.
如果有兴趣可以阅读实际代码here .
关于random - "Random Article"wikipedia.com 上的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1136775/