Question: Write a program in C to generate m random integers from an array of size n, such that the probability of selecting even elements is
Write a program in C to generate m random integers from an array of size n, such that the probability of selecting even elements is twice that of odd 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() function. Utilize the function rand() to generate a pseudo random number and the function srand() to seed the random number generator.
Where ArrayInp.dat is a list of random numbers.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
