Write a program to generate a series of pseudo random number

Assignment Help Computer Engineering
Reference no: EM13325027

You will write a program to generate a series of pseudo random numbers, using a linear feedback shift register method. You will start with an arbitrary number (not zero) x with a representation in n bits. If x = 15 and n = 4, then x = 1111. Then you will select a pair of bits, say bits 0 and 1, take their "xor" producing a new bit - in this case a 0. The number x will then shift to the right, with the new bit becoming the new high bit - in this case 0111. The process continues in this manner to produce a random set of bits. With four bits, we can only have up to 15 unique transitions before repetitions begin, or 2n - 1. With n = 32, the number of random bits has a much greater potential. The numbers actually produced by the "shifting" cannot be considered "random", since all but one of the bits overlap from each succeeding number. However, if we want to produce, say 100 6-bit numbers, then we need to shift the bits into an 6-bit register. We can then save its "value" in an array of 100 integers. Then we should produce the output which will display the distribution. Random numbers should follow a uniform
distribution. Using a 32-bit generator does not guarantee 2n - 1 random bits. For good results try using bit combinations 0/4, 0/7, 0/25, 0,26, 0/29.

Three random 4-bit numbers produced: 11, 13, 4, .... Try "tapping" different bit combinations, as well as the ones I suggested. To verify that the set of numbers you generated are really pseudo random, you will test them using the statistical χ2 test. You will generate 10,000 numbers in the 0-63 range. Then N=10,000 and r=64. You will then compute ∏2
by the formula

Example:
11001110 -> 11100111 -> 01110011 -> 10111001 -> 11011100 ->
11101110 -> 11110111 -> 01111011 -> 10111101 -> 01011110 -> etc

541_Assignment.png

if χ2 is in the range of r ± 2 r , we conclude that distribution is indeed random. Otherwise it may not be. In your program, you will implement a random number generator module. Then the program will request 10,000 random numbers in the range of 0-25. It will then apply the test to
see if the numbers are random. You should apply the test a number of times because it has a 1/10 chance of showing failure even when the random distribution is successfully generated.

You will implement the random number generator as a RandonGenerator C++ class. The constructor will have to initialize the seed value. Subsequent calls to the random( ) method with integer parameter range will return a random value in the range between 0 to range-1 inclusive. The tapping bits should be set by default (in the constructor)

Reference no: EM13325027

Questions Cloud

Determine the total time in the air : A projectile is fired with an initial speed of 37.8m/s at an angle of 44.7 degrees above the horizontal on a long flat firing range. Determine the total time in the air
Explain tosyl chloride and then a nucleophile : Write the structural formula of the main organic product for the following reaction between an alcohol, tosyl chloride and then a nucleophile
Correctional facilities rely heavily on offender management : Correctional facilities rely heavily on offender management and records management.
What is the velocity he must throw the grenade : A man throws a grenade from a car that is travelling at 90km/hr and wishes to throw it into a car heading in the same direction at 110km/hr
Write a program to generate a series of pseudo random number : You will write a program to generate a series of pseudo random numbers, using a linear feedback shift register method. You will start with an arbitrary number (not zero) x with a representation in n bits.
Determine calcium chloride in water : how many grams of CaCl2 are needed to make 638.2 grams of a solution that is 28.5% (m/m) calcium chloride in water
What is the length of the race in meters : A tortoise can run with a speed of 0.14 m/s, and a hare can run 20 times as fast. What is the length of the race in meters
The courts and police departments : Explain how technology in the area of computers has changed in both the courts and police departments.
Calculate how many electrons have been transferred : A capacitor has a capacitance of 2.74 10-8 F. In the charging process, electrons are removed from one plate, how many electrons have been transferred

Reviews

Write a Review

Computer Engineering Questions & Answers

  What elements did the new world view possess

What elements did the new world view possess that were to enable it to last until the "Idea of Progress" in the eighteenth century. Is it still part of who we still think we are today Does it still define our place in the cosmos

  Design function that accepts the cost of the purchase

Write down a function that accepts the cost of the purchase and the amount of the payment as functon parameters, and the prints on the cashiers console how much change to give (how many bills and coin). Consider denominations of 1cent, 5 cents, 10..

  Why user will indicate the time interval in minutes

Write a C++ program that creates a tab delimited file, balloon.txt, that could be opened by a spreadsheet to graph the altitude and velocity of a balloon as a function of time from the time of release by 48 hours.

  Determining the output

Specify the output if input is diamond diamond? State the output if the input is diamond gold?

  Generating the cipher text

Consider the plaintext is 101101101. If CBC is not used, what is the resulting ciphertext? If CBC is utilized along with the IV = 111, specify the resulting ciphertext? Show all work.

  Find out the retail price for each product

A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49; product 5, $6.87.

  Comprise the code to calculate the time in the program

use BubbleSort and MergeSort and save them as bubble and merge. Test the running times of your implementations on randomly(!) generated integer sequences of size n = 10, 100, 1,000, and 10,000.

  Program to compute the area and circumference of circle

Algorithm which will prompt for and receive the measurement of the diameter of a circle and compute and show the area and circumference of the circle.

  Gaussian distribution of known covariance s

Suppose we have training data from the Gaussian distribution of known covariance S but unknown mean Mu.

  Select either lisp or prolog and recommend changes

Neither functional programming languages nor logic programming languages are thought of as 'practical' programming languages. Choose either Lisp or Prolog and recommend changes to the language that you think would increase acceptance of the langua..

  Consider an adt called squarematrix

Consider an ADT called 'SquareMatrix'

  Developing the function to list software installed on system

Write down a function which list the software (name and vendor) installed over the computer specified by the input argument. The function should output the list to screen and output the list to the CSV file.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd