修复微软商店

tech2023-12-28  69

修复微软商店

Here’s an interesting mathematics and computer science question: how random is Microsoft’s new EU browser choice screen? It’s not, according to several statistical analysis articles published during the past week.

这是一个有趣的数学和计算机科学问题: 微软新的欧盟浏览器选择屏幕的随机性是多少? 根据过去一周发表的几篇统计分析文章,事实并非如此。

IBM engineer Rob Weir has produced one of the better reports about the browser ordering on browserchoice.eu. The non-randomness is quite complex and it didn’t necessarily favor Internet Explorer; IE appeared last half the time and Chrome was more likely to appear in the first 3 positions.

IBM工程师Rob Weir已在browserchoice.eu上生成了有关浏览器订购的更好的报告之一 。 非随机性非常复杂,不一定支持Internet Explorer。 IE出现的时间是上半场的时间,而Chrome更有可能出现在前3个位置。

使秩序混乱 (Bringing Chaos from Order)

Generating random numbers on a digital device is not easy. Most implementations use a mathematical function which returns a pseudo-random number. It may appear random, but the sequence is predictable. However, this is not the issue Microsoft encountered.

在数字设备上生成随机数并不容易。 大多数实现使用数学函数来返回伪随机数。 它可能看起来是随机的,但是顺序是可以预测的。 但是,这不是Microsoft遇到的问题。

There are various algorithms to ‘randomly’ shuffle an array of items but, according to Rob Weir, Microsoft chose the worst one. They used the following JavaScript comparison function for array.sort():

有多种算法可以“随机地”随机排列一系列项目,但据罗布·威尔说,微软选择了最差的一种。 他们对array.sort()使用了以下JavaScript比较功能:

function RandomSort(a,b) { return (0.5 - Math.random()); }

Since the comparison function returns a random result, the sorting process would receive inconsistent information regarding its progress. It could perform no swaps or, in theory, it could continue indefinitely. Ultimately, the results are not uniformly random.

由于比较函数返回随机结果,因此排序过程将收到有关其进度的不一致信息。 它不能进行任何交换,或者理论上可以无限期地继续。 最终,结果不是一致地随机的。

Weir suggests Microsoft should have used the Fisher-Yates shuffle. In essence, this randomly picks an item from the source array and moves it to the end of a destination array. The process continues until all items from the original array have been moved.

威尔建议微软应该使用Fisher-Yates洗牌 。 本质上,这是从源数组中随机选择一项并将其移到目标数组的末尾。 该过程继续进行,直到原始阵列中的所有项目都已移动。

有关系吗? (Does it Matter?)

In my opinion — no. Most individuals will see the screen once or twice. Shuffling inconsistencies do not become apparent until you examine population samples containing thousands of users.

我认为-不。 大多数人会看到屏幕一次或两次。 在检查包含数千个用户的总体样本之前,混洗不一致不会变得明显。

But do Microsoft need further legal wrangles? For all you lawyers excitedly anticipating a long-winded technical case about browser bias — you’re too late. Microsoft has changed their array shuffling algorithm:

但是微软是否需要进一步的法律纠纷? 对于您来说,所有律师都激动地期待着有关浏览器偏见的冗长技术案例- 您为时已晚 。 微软改变了他们的数组改组算法:

function ArrayShuffle(a) { var d, c, b=a.length; while(b) { c=Math.floor(Math.random()*b); d=a[--b]; a[b]=a

; a

=d; } }

Given a five-element array, the function will loop through elements 4 to 0 (variable b). A random number is generated between 0 and b (variable c). Elements b and c are then swapped. It’s not the Fisher-Yates algorithm, but it’s much better and will certainly end after 5 iterations (although it could end after 4 since the last element will always be swapped with itself).

I suspect it will result in a more uniform random distribution of browser positions. Eager statisticians will certainly be scrutinizing the results!

翻译自: https://www.sitepoint.com/microsoft-fix-their-non-random-browser-choice-screen/

修复微软商店

最新回复(0)