Assignment
1
Generation of random numbers
1)
Write a computer program that generates hundred 3 digit random numbers using the
Linear Congruential Generator (LCG) method with the parameter values given as,
Z
0
=7, a =5, C =19 and m = 128
(these values to be entered by user)
Random number
Z
i
= (a * Z
0
+ C)
(mod m)
Normalize the random numbers generated (Ui = Zi/ m) and plot histogram of the
normalized random numbers.
2) Repeat step 1 above, using rand() function in C and compare the output results.
Note
:
Conditions for selection of values to get the full period
a)
The only positive integer that divides both m and C is 1.
b) If q is a prime number, that divides m, then q divides a1
c)
If 4 divides m, then 4 divides a1
d)
0 <= m, a < m, C < m, Z
i
< m
e)
m gives period of repetition of random numbers and should be of the form 2
b
Reference Books:
1)
Simulation & Modeling ……… By
Law, Kelton
2)
Computer based simulation & modeling ……… By
Jerry Banks
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentAssignment
 2
Dijkstra’s shortest path algorithm

Enter number of nodes as well as numbers of source and destination nodes as
the input.

Each node is labeled with its distance from the source node along with the best
known path.

Initially, no paths are known. Hence all nodes may be labeled with infinity

As the algorithm proceeds and paths are found, the labels may change,
reflecting better paths.

This is the end of the preview.
Sign up
to
access the rest of the document.
 Summer '10
 MR.RAZA
 Cryptography, Graph Theory, Shortest path problem, clock tick

Click to edit the document details