Drawing Random Triangles

Write a program that displays 500 colored triangles on the screen. You must choose the color of each triangle randomly by selecting random values for the amount of red, green, and blue. Then select three random points for the vertices of the triangle. Each vertex will require two random numbers: one random x-value and one random y-value. This means that each triangle requires nine random numbers.

Finally, put all this stuff inside a loop that repeats 500 times.

Here is a working example version:




©2013–2105 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License