请参阅http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#setSeed(long)。代码将乘数播种,然后将其减少为mod 2 ^ 48。为什么不减少传递的种子mod 2 ^ 48?C等效种子48不执行异或。
您可以在这里找到一本不错的读物:java.util.Random\xe2\x80\x99s Magic Number 0x5DEECE66D。
\n\n和一个报价:
\n\nThe analysis says it was chosen simply because researchers determined empirically \nthat it produces a sequence of values satisfying various randomness tests\nRun Code Online (Sandbox Code Playgroud)\n\n还有这个文件也对神奇数字进行了尝试。
\n\n和另一句话:
\n\n\n\n\n然后我尝试搜索十进制值(不包括 Java),并在一些课堂笔记中找到了答案:
\n
http://nut.bu.edu/~youssef/py502/monte_carlo_supplement.ps \n http://www.inf.ethz.ch/personal/gaertner/texts/own_work/random_matrices.pdf
\n\nand in some computer documentation:\nRun Code Online (Sandbox Code Playgroud)\n\nhttp://developer.apple.com/documentation/Darwin/Reference/ManPages/html/_rand48.3.html
\n\nThe Youssef notes say:\n\n... I can only say that 25214903917_LONG and 11_LONG have\napparently been chosen by passing a battery of such [meaning\nMarsaglia\'s DIEHARD] tests.\n\n... Even in the case of the 48-bit generators we are discussing\ntoday, cas26 will generate them all in a month or two of CPU time\nand then start to repeat.\nRun Code Online (Sandbox Code Playgroud)\n