📄 ranrotw.cpp
字号:
/************************* RANROTW.CPP ****************** AgF 1999-03-03 *
* Random Number generator 'RANROT' type W *
* This version is used when a resolution higher that 32 bits is desired.*
* *
* This is a lagged-Fibonacci type of random number generator with *
* rotation of bits. The algorithm is: *
* Z[n] = (Y[n-j] + (Y[n-k] rotl r1)) modulo 2^(b/2) *
* Y[n] = (Z[n-j] + (Z[n-k] rotl r2)) modulo 2^(b/2) *
* X[n] = Y[n] + Z[n]*2^(b/2) *
* *
* The last k values of Y and Z are stored in a circular buffer named *
* randbuffer. *
* The code includes a self-test facility which will detect any *
* repetition of previous states. *
* The function uses a fast method for conversion to floating point. *
* This method relies on floating point numbers being stored in the *
* standard 64-bit IEEE format or the 80-bit long double format. *
* *
* The theory of the RANROT type of generators and the reason for the *
* self-test are described at www.agner.org/random/theory *
* *
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -