Random Number Generators - Homework III | COMP 385, Assignments of Data Structures and Algorithms

Material Type: Assignment; Class: DATA STRUCTURES II; Subject: Computer Science; University: Wentworth Institute of Technology; Term: Fall 2007;

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-h9v
koofers-user-h9v 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Wentworth Institute of Technology
Division of Professional and Continuing Studies
COMP385 Section 71 - Data Structures II - Fall, 2007
Homework 3 – Random Number Generators
Instructor: Bob Goldstein (617) 912-2512
http://home.comcast.net/~goldsteinr/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://myweb.wit.edu/goldsteinr/Courses/index.html
Due Date: September 25, 2007
Hand In: Printout of program code and dialogue of how it runs.
Purpose: This homework is intended to gain experience with testing of Random Number Generators.
Description:
Start with the TestRandomNumberGenerator program that we did in class.
1. Write a Random number generator that uses the “Middle Square” method of generating a random sequence
and add it to the program.
2. Test the LCG number generator with the following values for “a” and “m”.
a. a=23, m=10^8+1. Used by Lehmer in 1948
b. a=69069, m=2^32
c. make up your own values of a and m.
Extra Credit:
Write a random number generator that generates a Gaussian rather than uniform distribution and test it with the
TestRandomNumberGenerator program.
/app/work/qkd7dp-350659-2765068-homework3-doc.doc 1 12/1/2020 12/1/2020

Partial preview of the text

Download Random Number Generators - Homework III | COMP 385 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Wentworth Institute of Technology

Division of Professional and Continuing Studies

COMP385 Section 71 - Data Structures II - Fall, 2007

Homework 3 – Random Number Generators

Instructor: Bob Goldstein (617) 912- [email protected] [email protected] http://home.comcast.net/~goldsteinr/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: September 25, 2007 Hand In: Printout of program code and dialogue of how it runs. Purpose: This homework is intended to gain experience with testing of Random Number Generators. Description: Start with the TestRandomNumberGenerator program that we did in class.

  1. Write a Random number generator that uses the “Middle Square” method of generating a random sequence and add it to the program.
  2. Test the LCG number generator with the following values for “a” and “m”. a. a=23, m=10^8+1. Used by Lehmer in 1948 b. a=69069, m=2^ c. make up your own values of a and m. Extra Credit: Write a random number generator that generates a Gaussian rather than uniform distribution and test it with the TestRandomNumberGenerator program. /app/work/qkd7dp-350659-2765068-homework3-doc.doc 1 12/1/2020 12/1/