3 ms·
In MediaWiki, the "Random page" function works using an indexed page_random column, see https://m.mediawiki.org/wiki/Manual:Page_table#page_random https://m.med
by mormegil 5y ago
In MediaWiki, the "Random page" function works using an indexed page_random column, see https://m.mediawiki.org/wiki/Manual:Page_table#page_random https://m.mediawiki.org/wiki/Manual:Page_table#page_random
For a large enough wiki, the potential non-uniformness is negligible, I guess. (Unless your RNG is wrong, see https://phabricator.wikimedia.org/T208909 https://phabricator.wikimedia.org/T208909)
- anoncake 5y agohttps://www.mediawiki.org/wiki/Manual:Page_table#page_random https://www.mediawiki.org/wiki/Manual:Page_table#page_random
- im3w1l 5y agoIt's not neglible at all. I generated 10 million uniform numbers and made a histogram of the log10(probability) - there are dramatic differences in probability for different pages. Now, since the random page is just for fun, that may be considered acceptable. import numpy as np import matplotlib.pyplot as plt n = 10_000_000 np.random.seed(0) a = np.random.random([n]) a.sort() b = np.append(a[1:] - a[:-1], 1 + a[0] - a[-1]) plt.hist(np.log10(b), bins=100) plt.show() Some highlights: The lowest probability page had a mere 1e-14 chance, while the highest had a 1e-6. The 90th percintile was 20 times more likely than the 10th. https://imgur.com/a/WBLh3kQ https://imgur.com/a/WBLh3kQ
- mormegil 5y agoYeah, right, that’s what I considered “acceptable” for such a fun-only functionality, I guess. Not that it would be too surprising, since the behavior is a general property of the (ermph… Laplace? Poisson? oh, whatever) distribution, right? Still, I made this histogram for the real probabilities of Wikipedia articles (for enwiki and my home cswiki) and it turned out to look the same (meaning the random number generator is not obviously superbad), see https://gist.github.com/mormegil-cz/84d0cc34eb5f1234be8966f7c5498d9c https://gist.github.com/mormegil-cz/84d0cc34eb5f1234be8966f7...