Pseudo-random numbers/Combined recursive generator MRG32k3a: Difference between revisions
Pseudo-random numbers/Combined recursive generator MRG32k3a (view source)
Revision as of 15:02, 21 August 2021
, 2 years ago→Mimicking the Pseudo-code
(→{{header|Ruby}}: Added version following OP's pseudo-code) |
|||
Line 1,298:
x1i = (A1[0]*@x1[0] + A1[1]*@x1[1] + A1[2]*@x1[2]).modulo M1
x2i = (A2[0]*@x2[0] + A2[1]*@x2[1] + A2[2]*@x2[2]).modulo M2
@x1
@x2
z = (x1i - x2i) % M1
return z + 1
|