[wp-trac] [WordPress Trac] #51739: Randomize Header Images aren't actually random

WordPress Trac noreply at wordpress.org
Tue Nov 10 04:03:56 UTC 2020


#51739: Randomize Header Images aren't actually random
--------------------------+----------------------
 Reporter:  richbhanover  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by Otto42):

 If you're using the standard methods, then it eventually selects the
 header image using PHP's array_rand function. See
 https://www.php.net/manual/en/function.array-rand.php for more info.

 Now, that function uses a pseudo random number generator which is not
 actually random, but let's assume it was, for funzies.

 You have 24 images. What are the odds that you get the same one twice in a
 row? You might be surprised to learn that the answer is 1 in 24.
 Therefore, in a tiny sample test of 100, that should happen a bit more
 than 4 times.

 Why is it one in 24? Well, if we assume that each random choice is
 independent, then you pick one out of 24, and then you pick again, out of
 the same set of 24. The first choice actually doesn't matter, we're only
 concerned that the second one is the same as the first. And it has a 1 in
 24 chance to be the same, if the randomization is true and fair.

 People don't understand what "random" really means. It doesn't mean
 average, it doesn't mean equal, and it certainly doesn't mean that you
 don't get the same thing twice. You often get a result a lot more than you
 think you will, if you just think about it for a bit.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51739#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list