Question: Please use only mathlab or python to solve and include all of the steps with solution. Different PRNGs in Matlab The latest version of Matlab
Please use only mathlab or python to solve and include all of the steps with solution.
Different PRNGs in Matlab The latest version of Matlab has many different methods for creating pseudo-random uniform(0, 1) sequences. You can create multiple sequences (often called "streams") using different seeds or different methods and compare them. Here's how to create 3 different streams using 3 different methods. methodl RandStream ('mcg16807') method2RandStream (' swb2712) method3 Randstream ('mt19937ar' Method I was Matlab's default before 1995. It is a LCG with m-231-1 and a = 75. It is too simple for modern applications. Method 2 was Matlab's default from 1995 to 2006. It is not a LCG and it is awful. I once spent many hours debugging before I realized that the problem was with this PRNG. Method 3 is the Mersenne Twister, which is currently a very popular PRNG and which is Matlab's default since 2007. Assuming you have a recent version of Matlab, then if you just use rand in Matlab, then you will get method 3 without having to specify anything. To generate an r x c array of pseudo-random numbers using one of these streams and store it in the matrix U, type U-rand (method?, r,c); where you replace the ? with one of the numbers 1,2, or 3 to get the desired method. IOn later homework sets, when we are finished exploring PRNGs and just want the best PRNG, you can use Urand (r,c) without specifying a method. This uses the default method 3, in this case - which seems to be the best of Matlab's choices.] Demo Convince yourself that the PRNGs are deterministic. For example, create two copies of method 3, say method3a Randstream ('mt 19937ar') and method3b RandStream('mt19937ar') Now rand (method3a) and rand (method3b) should behave identically. Call them repeatedly to verify. Four different PRNGs A. The LCG that you created in problem 1 [after converting to (0, 1) by dividing each Rn by ml. B. Matlab method 1 above. C. Matlab method 2 above. D. Matlab method 3 above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
