Random A

Remember to include System.Random to make these exercises work.

  1. Print a random integer in the range [1,10].

  2. Print a random Double in the range [100,200].

  3. Make a circle of radius 2 centered at the origin with a random color from this list:

     somecolors = [red, orange, yellow, green, blue, purple]
    
  4. Create a function that takes in a StdGen and produces a random color from the somecolors list (above).

  5. Create a CS record (data) that holds a pt :: Point, a cx :: Color, and a gen :: StdGen.

  6. Given a CS record, draw a solid radius 1.0 circle of that color at the point in the record.

  7. Make a drawing that selects new a random coordinate and color every time the person hits a key. Except hitting “C” should just randomly change the color.

Last modified November 21, 2024: Change positions and title. (d4b42f5)