Computer Science 112
The Art & Science of Computer Graphics
Fall 2015, The College of Saint Rose
Lecture 19: Random Numbers; More Replication
Date: Friday, November 6, 2015
Agenda
Lecture 19 Assignment
Due at the start of class, Wednesday, November 11.
Please submit answers to these questions
either as a hard copy (typeset or handwritten are OK) or by email to
terescoj AT strose.edu by the start of class. Please use a clear subject line
when submitting by email (e.g., CSC 112 Lecture
19 Assignment , Joe Student). We will discuss these
questions at the start of class, so no late submissions are
accepted.
- Modify this example:
On the Wiki: Manyconesrotated, Downloadable file: manyconesrotated.py
to choose random rotation amounts for each cone as is it added. (6 points)
- Write a series of Python statements that create a "plastic"
material whose color is a randomly chosen shade of gray. Hint: you
can use either HSV or RGB colors as a starting point, but you'll
need to remember what kinds of values represent greyscale colors in
whichever you choose. (5 points)
- Write a Python loop that prints out 5 random numbers in the
range 1 through 6 (simulating the dice roll in a game of Yahtzee).
(3 points)
- Write a Python loop that generates 100 random integers in the
range 0-100 and prints out their sum. (6 points)
Terminology
- deterministic
- non-deterministic
- random numbers
- integers
- real numbers
- floating-point numbers
Examples