Question

Generate at least 20 random numbers within the range of 1 to 900 using linear congruent...

Generate at least 20 random numbers within the range of 1 to 900 using linear congruent method. Xi = (aXo + C) mod m using a = 87, c = 29 and Xo = 19

Homework Answers

Answer #1

Using the linear congruence Xi = (aXo + C) mod m, we want to generate random numbers 1 to 900, so we can take m = 901 so that maximum remainder can be 900.  (using a = 87, c = 29 and Xo = 19)

X1 = (87*19 + 29) mod 901 or X1 = 781
X2 = (87*781 + 29) mod 901 or X2 = 401
X3 = (87*401 + 29) mod 901 or X3 = 678
X4 = (87*678 + 29) mod 901 or X3 = 450
X5 = (87*450 + 29) mod 901 or X3 = 436 and so on.
The first 20 generated random numbers are:

781, 401, 678, 450, 436, 119, 471, 461, 492, 486, 865, 501, 368, 510, 250, 155, 900, 843, 389, 535.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1) Consider a linear congruential random number generator with parameters a = 35, c = 20...
1) Consider a linear congruential random number generator with parameters a = 35, c = 20 and m = 100. a- Generate 5 random numbers by using this method. Use 84. b- By using inverse transform method, generate 2 random variate for an exponential distribution with parameter λ = 0.5. Use the first two random numbers you generated in part a.
Write program to generate random numbers in different range and display: (c) A number in range...
Write program to generate random numbers in different range and display: (c) A number in range [0, 10) (d) A number in range [0, 1000] (e) A number in range [-99, 99] (f) A double number in range [1000.0, 9999.0) In Java Please
C++ Generate 100 random numbers of the values 1-20 in an input.txt. Now create a binary...
C++ Generate 100 random numbers of the values 1-20 in an input.txt. Now create a binary search tree using the numbers of the sequence. The tree set should not have any nodes with same values and all repeated numbers of the random sequence must be stored in the node as a counter variable. For example, if there are five 20s’ in the random sequence then the tree node having data 20 has counter variable equal to 5. Sort the sequence...
In C language generate 1000 pseudo random numbers in the inclusive range [0..1000] , average them,...
In C language generate 1000 pseudo random numbers in the inclusive range [0..1000] , average them, find the variance, standard deviation, and send a message encoded using Morse code as a light encoded message with a SHA-1 hash.   
Using a for loop and range command, print the sequence of numbers from 1 to 20...
Using a for loop and range command, print the sequence of numbers from 1 to 20 (skipping two numbers for each element); that is, your code should print out the numbers 1,4, 7, 10, … (max should not exceed 20). Use x as the variable name
#5. You can find 20 RANDOM NUMBERS in a Table or you can generate them with...
#5. You can find 20 RANDOM NUMBERS in a Table or you can generate them with software like Excel. The Excel functions are “RAND” and “RANDBETWEEN”. With “Randbetween” you simply input how many numbers you want, the number of digits you want in your random number and the range of values you want those numbers to fall between. For example you may want twenty, 2-digit numbers that fall between 00 and 100 (like “34”). TWO CONSIDERATIONS: (1) You must systematically...
(1) Use ‘sample’ function to generate a vector of 100 random numbers that follows a multinomial...
(1) Use ‘sample’ function to generate a vector of 100 random numbers that follows a multinomial distribution with probability (0.1, 0.15, 0.3, 0.45). (2) Without using the ‘sample’ function, generate a vector of 100 random numbers that follows a multinomial distribution with probability (0.1, 0.15, 0.3, 0.45). (3) Calculate the probability for 2.5 < X < 9 in a Poisson distribution with the mean 6. (using R)
Use another random decimal fraction generator at Random.org, linked here, to generate a list of ten...
Use another random decimal fraction generator at Random.org, linked here, to generate a list of ten two-digit random numbers between 10 and 30. Calculate the z-score of the median of the data set. Set 1: 11, 12, 15, 18, 19, 20, 21, 24, 28, 29
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array...
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array to a temp array 3.) Call each of the methods to sort (bubble, selection, insertion, quick, merge), passing it the array 4.) In-between the calls, you are going to refresh the array to the original numbers. 5.) Inside of each sorting method, you are going to obtain the nanoseconds time, before and after the method Subtract the before time from the after time to...
Use R and the RANDBETWEEN(1,300) function to generate: a) 100 random numbers, b) 100 samples of...
Use R and the RANDBETWEEN(1,300) function to generate: a) 100 random numbers, b) 100 samples of size 5, and c) 100 samples of size 20. For each sample in parts (b) and (c), find the sample means. Create histograms for parts (a), (b) and (c). For part (a) use the random numbers (i.e. sample size 1), for parts (b) and (c) use the sample means to create the histograms. Copy and Paste just the histograms into your homework paper. Explain...