Question
Please notice it is required to use this instruction for all number generation instructions, so do not make any change of this. Also, do NOT
Please notice it is required to use this instruction for all number generation instructions, so do not make any change of this. Also, do NOT use or make change to the random variable generator seeds. This may result in different distribution and failure to pass the tests. Write a single code, randTest.c, that uses the instruction above to generate every single number and implements all the tests given in table 2. Use the parsing command line arguments through the main function (with a single character parameter after the file name) to select and perform a single test in the runtime. E.g., suppose the executable file is named, ranTest.out, if in the runtime one wishes running the first test, they just have to type ranTest.out 1, if the second, ranTest.out 2, etc. Notice it is a requirement to use gcc and the MSc cyber program VM to develop this code. Please refer to week 1 material for that. Table 2: Tests Test Deception 1. Mean test Calculate and display the mean of 1000 random numbers. The result should be close to 4.5. 2. Frequency test Tabulate the percentage of each digit (0 throughout 9) in 10,000 generated numbers. Each Is expected to be close (roughly) to 10%. 3. Serial test Generate 10,000 pairs of numbers. Tabulate the percentage of each pair, 00, 01,02, .., 99. This time we would expect roughly 1% in each category. 4. Poker test Generate four digits at a time, and repeat 1,000 times (a thousand sets of 4 digits in total). Tabulate the cardinalities of the sets (the four digit tuples) as: i) all the same (e.g. 4444), ii) 3 digits the same (e.g. 4443, 3444 or 4344), iii) two pairs (e.g. 4334, 4433), iv) one pair (e.g. 4324 or4342), or v) none identical. In theory we would expect 1, 36, 27, 432 & 504 for each set respectively for a thousand sets of numbers (i.e., 4,000 digits). You will not necessarily get those exact numbers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started