是161803398 A'特殊'号?里面的Math.random()的 [英] Is 161803398 A 'Special' Number? Inside of Math.Random()

查看:289
本文介绍了是161803398 A'特殊'号?里面的Math.random()的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑,答案是数学,因为',但我希望有人能在一个基本水平多加一点见解...

I suspect the answer is 'Because of Math', but I was hoping someone could give a little more insight at a basic level...

我今天闲逛在BCL源$ C ​​$ C,有一个看看如何一些我以前用过的类被实际执行。我从来没有想过如何随机数之前产生(伪),所以我决定,看它是怎么做的。

I was poking around in the BCL source code today, having a look at how some of the classes I've used before were actually implemented. I'd never thought about how to generate (pseudo) random numbers before, so I decided to see how it was done.

在这里完整的源:<一href="http://referencesource.microsoft.com/#mscorlib/system/random.cs#29">http://referencesource.microsoft.com/#mscorlib/system/random.cs#29

private const int MSEED = 161803398; 

这MSEED值,使用的每一个随机()类接种时间。

This MSEED value is used every time a Random() class is seeded.

不管怎样,我看到了这个神奇数字 - 161803398 - 我没有为什么,这个数字被选中的foggiest想法。它不是一个质数或2的乘方它不是中途为一个数字,显得比较显著。我的二进制和十六进制看了一下,好了,它只是看起来像一个号码给我。

Anyway, I saw this 'magic number' - 161803398 - and I don't have the foggiest idea of why that number was selected. It's not a prime number or a power of 2. It's not 'half way' to a number that seemed more significant. I looked at it in binary and hex and well, it just looked like a number to me.

我试图寻找在谷歌的数字,但我什么也没找到。

I tried searching for the number in Google, but I found nothing.

推荐答案

没有,但它是基于披(以下简称黄​​金比例)。

No, but it's based on Phi (the "golden ratio").

161803398 = 1.61803398 * 10^8 ≈ φ * 10^8

更多的黄金比例按此

和一个确实的好读的休闲数学家这里

And a really good read for the casual mathematician here.

,我发现的研究论文对随机数生成器的那同意这一说法。 (见第53页。)

And I found a research paper on random number generators that agrees with this assertion. (See page 53.)

这篇关于是161803398 A'特殊'号?里面的Math.random()的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆