Microsoft can't offer browsers randomly

    On a habr already wrote about the browser selection module for European users: “The browser selection module appears as Windows updates. The five most popular ones are shown right away (Apple Safari, Google Chrome, Microsoft Internet Explorer, Mozilla Firefox, and Opera). And in a random order. ”

    As the guys from the Slovak site DSL.sk found out, the module has big problems with the random output of browsers. Page, with which it is supposed to comply with the requirements of the European Union, does not display a list of browsers in random order, as intended. Instead of generally accepted algorithms, the worst case scenario is the mixing of the list of browsers through array sorting with a comparison function that returns a random result. Because of this, instead of the equiprobable placement of browsers in the list, an offset is obtained. Thus, for IE, the probability of being in last place on the first page for some reason turned out to be the greatest (~ 50%)! However, at the same time, it always appears initially in the first place, and only after the end of the "mixing" changes its location. Interestingly, the above algorithm is issued first when searching for “javascript randomize array” in both google and bing :)

    image

    Technical details of the investigation (in English) .

    PS: As naum suggested , the code on the page was fixed .

    Also popular now: