# Class 32: Randomized (Unpredictable) Drawing

Back to Naming Local Procedures. On to Numeric Recursion.

This outline is also available in PDF.

Held: Friday, March 19, 2010

Summary: We consider Scheme's `random` procedure, how one might use that procedure in writing simple simulations, and how the procedure can be used to generate unpredictable images.

Related Pages:

Notes:

• Reading for Monday (after break): Numeric Recursion.
• No surprises today. Sorry.
• Have a great break.
• CS Table Today: The Art of Computer Programming.
• Yes, I know that there's a lot more errata on the exam. I'm behind in incorporating it.

Overview:

• Random art.
• Why use randomness.
• The `random` procedure.
• Simulation.

## Randomized Images - The Theory

• Non-mainstream art philosophy: The images that come from random processes (or from nature) can be as interesting as the images that come from artists who intentionally plan the canvas.
• One important movement: Dada. (Early 20th century; also a reaction to facism and industrialization and ...)
• An example: Tristan Tzara's How to make a Dadaist Poem
• Disclaimer: After creation by random processes, some filtering of good from bad often happens.
• Disclaimer: Many of the random processes still include some artistic intention.
• Jackson Pollock's painting style provides an interesting combination of intent and randomness.
• Modernized/computational suggestion:
• Randomized processes can provide inspiration
• The ability to constrain some aspects of the process can provide a new mechanism for creation.

## The `random` Procedure

• Scheme helps us by providing a `(random n)` procedure.
• `n` must be a positive integer.
• `random` returns an integer between 0 and `n`-1, inclusive.

## Randomized Images - Practice

• Many of the procedures we've written or used have numeric parameters.
• Those parameters can be generated randomly.
• Many of the procedures we've written take one of a restricted number of inputs (e.g., there are only so many brushes).
• Those inputs can also be selected randomly.
• Demo: Randomizing the brush

## Other Uses of Randomness

• We often use randomness in simulating unpredictable events, such as the rolling of an unbiased die.
• More requently, such randomness is used in larger-scale simulations.
• We'll stick with images, though.

## Lab

Back to Naming Local Procedures. On to Numeric Recursion.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 11 09:03:13 2010.
The source to the document was last modified on Thu Jan 21 13:05:08 2010.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2010S/Outlines/outline.32.html`.

You may wish to validate this document's HTML ; ;

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2007-10 Janet Davis, Matthew Kluber, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials copyright by John David Stone and Henry Walker and used by permission.) This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.