How to resolve the algorithm Pseudo-random numbers/Combined recursive generator MRG32k3a step by step in the Pari/GP programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Pseudo-random numbers/Combined recursive generator MRG32k3a step by step in the Pari/GP programming language
Table of Contents
Problem Statement
numbers as shown above.
are as shown above
repetitions of
Is as follows:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Pseudo-random numbers/Combined recursive generator MRG32k3a step by step in the Pari/GP programming language
Source code in the pari/gp programming language
a1 = [0, 1403580, -810728];
m1 = 2^32-209;
a2 = [527612, 0, -1370589];
m2 = 2^32-22853;
d = m1+1;
seed(s)=x1=x2=[s,0,0];
next_int()=
{
my(x1i=a1*x1~%m1, x2i=a2*x2~%m2);
x1 = [x1i, x1[1], x1[2]];
x2 = [x2i, x2[1], x2[2]];
(x1i-x2i)%m1 + 1;
}
next_float()=next_int()/d;
seed(1234567);
vector(5,i,next_int())
seed(987654321);
v=vector(5); for(i=1,1e5, v[next_float()*5\1+1]++); v
You may also check:How to resolve the algorithm Parsing/Shunting-yard algorithm step by step in the Perl programming language
You may also check:How to resolve the algorithm Find the intersection of a line with a plane step by step in the C++ programming language
You may also check:How to resolve the algorithm 100 doors step by step in the F# programming language
You may also check:How to resolve the algorithm Padovan n-step number sequences step by step in the Perl programming language
You may also check:How to resolve the algorithm Maze generation step by step in the Action! programming language