mother.cpp
来自「random number generator,随机数产生器」· C++ 代码 · 共 17 行
CPP
17 行
/************************** MOTHER.CPP ****************** AgF 1999-03-03 *
* 'Mother-of-All' random number generator *
* *
* This is a multiply-with-carry type of random number generator *
* invented by George Marsaglia. The algorithm is: *
* S = 2111111111*X[n-4] + 1492*X[n-3] + 1776*X[n-2] + 5115*X[n-1] + C *
* X[n] = S modulo 2^32 *
* C = floor(S / 2^32) *
* *
* IMPORTANT:
* This implementation uses a long double for C. Note that not all *
* computers and compilers support the long double (80-bit) floating *
* point format. It is recommended to use a Borland or Gnu compiler on *
* a PC. The Microsoft compiler doesn't support the long double format. *
* You will get an error message if your system doesn't support this. *
* *
*
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?