Operation Random!

Your mission, should you decide to accept it, is to define a fruitful function named randomColor that has no input parameters and returns a string. Your function should perform the following two steps:

  1. Generate a random integer — you may invoke the function randomInt() that is provided to help with this task. The randomInt() function takes one argument, a number, and returns an integer from 0 up to but not including the number.
  2. Return a string that is the name of a randomly chosen color. Your function should generate at least five colors, such as "red", "green", "magenta", "cyan" and "yellow." Please do not include "blue" as a possible color!

Write your function definition on the whiteboard set aside for your team. After your definition has been cleared by one of your mission leaders (Scott or Anna), implement and test your function as follows:

Operation Random

A header with three words in random colors will appear below, after you add your definition of the randomColor() function:

When you're done, upload the code file to the MI6 folder in the public_html directory of the cs110d account. Your mission leaders will give you the password.