random - "Random Article"wikipedia.com 上的功能

标签 random wiki

我想知道维基百科使用什么算法和编程语言来随机选择要显示的文章。

我也想知道它是如何工作得这么快的?

最佳答案

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/

相关文章:

mysql - wiki 站点是如何工作的,我指的是 sql 结构

templates - 有没有办法通过模板将 </onlyinclude> 包含到 MediaWiki 页面上?

java - 我有时会出错,有时不会?

random - 如何随机化一个非常大的内存的内容?

variables - Applescript 中从 1 到变量的随机数

api - WikiTravel 有 API 吗?

javascript - 如何在 wiki 页面中输入 Javascript?

长度为 n 且正好为 k 的 bool 值的 Pythonic 随机列表

python - 如何从具有特定阈值的列表(包含 1 到 n 个值)中随机选择一个否?

wiki - 有没有更好的方法来创建 MediaWiki 编号列表?