Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Distribution of Software Generated Pseudo Random Numbers - Module Assessment

Assessment Title: Distribution of Software Generated Pseudo Random Numbers

Table 1 summarizes the module assessment component and their respective ratios.

Table 1: Elements of the Module Assessment

Element

Weight

A.1 Individual part

A.2 Group Project (Demo and presentation)

This is the element A.1 with a ratio of 25% of the overall module assessment. It consists in implementing a simple pseudo random number generator in C language using the rand() function of “stdlib.h” and writing test programs to assess its quality. Please notice that in this task we are not seeking generating real random numbers but just interested in investigating the distribution of pseudo random numbers generated by the rand() function. The tests you are going to implement were theoretically suggested by Kendall & Babbington-Smith over a series of papers published in 1938/39.

The rand() function returns a pseudo-random integer between 0 and RAND_MAX, which is defined in stdlib.h. You should NOT replace it with a constant since its value may vary with platforms. You need to rescale this value and fit it between 0 and 10 (0 included, 10 excluded). To generate a single pseudo random number between 0 (included) and 10 IN YOUR code, use the following.

randon_number = (int) (10.0*rand()/(RAND_MAX + 1.0));

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.

Table 2: Tests

Test

Deception

1. Mean test

Calculate 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 frequency 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). Tabulate the sets 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 frequencies of 1, 36, 27, 432 & 504 respectively for a thousand sets of numbers (i.e., 4,000 digits). You will not necessarily get those exact numbers.

5. Pocker Test using a file

Generate 4,000 random digits and save them in a text file (using ASCII coding), where characters are separated by spaces. Repeat the poker test by reading the numbers from the file.

For this part (Part A.1: individual E-portfolio), please upload:

  • A single .c source file that is clearly organized and well commented on the Blackboard. Please name it randTest.
  • Self-assessment form: using the template provided.  

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close