I want to complete this using c++ but I am not sure how to address this problem.
ID: 3821158 • Letter: I
Question
I want to complete this using c++ but I am not sure how to address this problem. Thank you
Using the high-level programming language of your choice, write a program that compares your system's built-in random number generation function with LFSR and LCG implementations pseudo-random number generators. Program specifications: a) Write functions FRANULPSR and RAN-LCG that generate randam 24-bit values using the methods described above. Each time one of these functions is called, it should use the appropriate algorithm to generate the next random number in its sequence. Use the following parameters for the LFSR and LCG: LFSR: 1 1140671485 (Obw43FD43FD) c 12820163 (0xC39EC3, use all 24 bits to grnerate the value After generating the next 24-bit value, the function should return a real number in the range b) Initialize the LFSR and the LCG to0xFFFFFF (24 bits, all *i's) when the program starts. c) Generate 10.000 sets of random values using the built-in random number function. RAN-LFSR, and RAN-LCG. As the program runs, it should generate the following results: i. Atable, similar to the following, showing the first 25random values generated by each method. (The following are not the actual values that should be generated.) 0.a3ages unction ii. Asummary table, similar to the following, listing the mean and standard deviation of the random values generated by each method. Print this table after 25. S0, 100, 500, 000, 5000, and 10000 sets of random numbers. The first row in the summary table should comes pond to the random numbers from part bove, allowing you to verify your calculations. he following are not the actual expected values) meanExplanation / Answer
//providing the two functions rest are dooable
float RAN_LFSR()
{
unsigned bit;
for (i = 1; i <= 24; i++) {
bit = ((lfsr >> 0) ^ (lfsr >> 1) ^ (lfsr >> 2) ^ (lfsr >> 7) ) & 1;
}
return (bit/pow(2, 24));
}
float RAN_LCG()
{
return (1140671485 + 1282)%pow(2,24);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.