Question: 3. Write a program to generate m random integers from an array of size n, such that the prob- ability of selecting even indexed elements

 3. Write a program to generate m random integers from an

3. Write a program to generate m random integers from an array of size n, such that the prob- ability of selecting even indexed elements is twice that of odd indexed elements. The same element may be selected multiple times. As an example, let n = 100 and m = 30, Read in the array elements from the provided data file ArrayInp.dat, using the fscanf func- tion. Utilize the function rand to generate a pseudo random number and the function srand ) to seed the random number generator. Start with the code RandomArrayGen- erate.c provided on the Blackboard. An example on generating random numbers in a given range can be found at the link http ://www.cplusplus.com/reference/cstdlib/rand

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!