Pseudo-random numbers/Combined recursive generator MRG32k3a: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Raku}}: copy pasto) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: eliminate some intermediates, slightly more efficient) |
||
Line 144: | Line 144: | ||
method next-int { |
method next-int { |
||
@!x1.unshift: (a1[0] * @!x1[0] + a1[1] * @!x1[1] + a1[2] * @!x1[2]) % m1; @!x1.pop; |
|||
@!x2.unshift: (a2[0] * @!x2[0] + a2[1] * @!x2[1] + a2[2] * @!x2[2]) % m2; @!x2.pop; |
|||
@!x1 |
(@!x1[0] - @!x2[0]) % m1 + 1 |
||
@!x2 = $x2i, |@!x2[0, 1]; |
|||
($x1i - $x2i) % m1 + 1 |
|||
} |
} |
||