Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

a statistics teacher wishes to create a program on her calculator that …

Question

a statistics teacher wishes to create a program on her calculator that generates a random even integer. the command built in the calculator to generate a random positive integer is random(a,b). this command generates a random integer between integers a and b (and including a and b). which of the following lines of code will ensure that the random integer generated will be even?

random(a,b) + 1
random(a,b) - 2
random(a,b) + 2
random(a,b) * 2

Explanation:

Step1: Recall property of even numbers

An even number is divisible by 2. If we multiply an integer (random or otherwise) by 2, the result will always be an even number.

Step2: Analyze each option

  • For RANDOM(a,b)+1, adding 1 to a random integer may or may not result in an even number. For example, if RANDOM(a,b) is even, RANDOM(a,b)+1 is odd.
  • For RANDOM(a,b) - 2, subtracting 2 from a random integer does not guarantee an even - numbered result. If RANDOM(a,b) is odd, RANDOM(a,b)-2 is odd.
  • For RANDOM(a,b)+2, adding 2 to a random integer does not guarantee an even - numbered result. If RANDOM(a,b) is odd, RANDOM(a,b)+2 is odd.
  • For RANDOM(a,b)*2, since any integer multiplied by 2 is an even number, multiplying the random integer generated by RANDOM(a,b) by 2 will ensure that the result is an even number.

Answer:

RANDOM(a,b) * 2