Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Incubator escapee wiki:FAQ/Technical
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Is the "random article" feature really random? {{anchor|random}} == : No, although it's random enough to provide a small sample of articles reliably. : In the Wikipedia [[database]], each page is assigned a "random index", which is a random floating point number uniformly distributed between 0 (inclusive) and 1 (exclusive). The "random article" feature (Special:Random) chooses a random [[double-precision|double-precision floating-point number]], and returns the next article whose random index is greater than the selected random number. Some articles will have a larger gap before them, in the random index space, and so will be more likely to be selected. So the actual probability of any given article being selected is in fact itself random. : The random index value for new articles, and the random value used by Special:Random, is selected by reading two 31-bit words from a [[Mersenne twister]], which is seeded at each request by PHP's initialisation code using a high-resolution timer and the PID. The words are combined using: ::(mt_rand() * $max + mt_rand()) / $max / $max :Some old articles had their page_random value reset using MySQL's RAND(): :: rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value; :: rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value; :: return (((double) rand_st->seed1)/rand_st->max_value_dbl); :Due to [[phab:T208909|a bug]], many pages created in 2004 and 2005 used to have non-random page_random values; this was corrected in 2018.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)