Question: Generate any number of random integers between 20 and 100 from the uniform distribution [ 3 points]. Write a function to do the following: Accept

  1. Generate any number of random integers between 20 and 100 from the uniform distribution [ 3 points].
  2. Write a function to do the following:
    • Accept just one integer vector as an input parameter [2 points].
    • Perform the rest of the operations only if the input is an integer vector with at least ONE element. If not, return NA [4 points].
    • Return ONE numeric vector (numbers with 2 decimal places) [1 point].
    • Run a loop on the input vector to perform the following calculations to generate the final vector [10 points].
      • If the index is even, the output is the square of the number.
      • If the index is odd, the output is the square root of the number.

Step by Step Solution

3.28 Rating (148 Votes )

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!