On Sep 16, 2004, at 1:34 PM, samuel wrote:
- How is cur_random set in the first place?
A random number is selected and set at article creation.
- What is the precision of cur_random and randstr? (I don't speak
PHP, so I can't tell from the code.)
mt_rand_max() is (2^31)-1, so there should be ~2 billion possible random numbers.
cur_random is of type 'double', which I believe is 64-bit floating point. I _think_ PHP uses doubles for floating-point numbers internally, but I'm not sure.
Speaking SQL the numbers are converted to decimal and back, so some precision may be lost. Queries look something like this:
SELECT cur_id,cur_title FROM cur USE INDEX (cur_random) WHERE cur_namespace=0 AND cur_is_redirect=0 AND cur_random>0.440311077722 ORDER BY cur_random LIMIT 1
- How many articles are there?
http://en.wikipedia.org/wiki/Special:Statistics
-- brion vibber (brion @ pobox.com)