3. Randomize coordinates
Write a complete function definition for a function called randomizeCoords
. This function should set the values of three global variables, x
, y
, and z
to three different random numbers from 1-100. The global variables are already defined "behind the scenes", so do not define them yourself, just set their values. Your function should not return any values or receive any inputs, only set values.
You can get a random number by calling the random
function. That function takes two inputs, the low end of the range of possible numbers followed by the high end. For example:
n = random(5, 40);
Sets n to a random number from 5-40. Since you want your three variables to all be different random numbers, make sure you call random
multiple times.
Note: For the purposes of this problem, please have your function assign values to x
first, then y
, then z
, to allow the auto-grader to work correctly.
Be careful with your function definition syntax. Make sure to include every required part: return type (or void), function name, inputs (if any), and code.