On Habré already wrote about the browser selection module for European users: “The browser selection module appears as Windows updates.Immediately shows the five most popular (Apple Safari, Google Chrome, Microsoft Internet Explorer, Mozilla Firefox and Opera).And in random order. ”
As the guys from the Slovak site DSL.sk have found out, the module has big problems with the random order of browser output. The page , which is supposed to fulfill the requirements of the European Union, does not display a list of browsers in a random order, as expected. Instead of the generally accepted algorithms, the worst-case implementation of mixing the list of browsers is used by sorting an array with a comparison function that returns a random result. Because of this, instead of equiprobably placing browsers in the list, the result is offset. Thus, for IE, the probability of being in the last place of the first page for some reason turned out to be the highest (~ 50%)! However, at the same time, it is always shown initially in the first place, and only after the end of “mixing” does it change its location. What is interesting, the above algorithm is given first when searching for “javascript randomize array” in both google and bing :)