## Randomized Vectors – Example 6.4

If you’ve stuck with the examples this far, this one should prove pretty easy. I am showing it here for a bit more practice with vectors and data structuring, but this will serve as a base for a Recursive pattern script in the next series of examples.

**Step One –** Setup a base grid of points. Setup a starting rotation for the vectors at each point. The logic is similar, but executed in a slightly different way than the starting vector in Example 6.3.

**Step Two – **I could just random rotate all the vectors at once by flattening the grid, but for this example I wanted to control the “noise” or degree of random rotation for the rows and columns independently. I started with two variables which I called “Row Distortion” and “Column Distortion.” A value of “20” for row distortion means then, that the first range of rotations, based on rows, can have a rotation between -20° and 20° Since i didn’t flatten my data structure, after the first set of random rotations, each item in every row will have the same rotation. To rotate the vectors, use the “Rotate Vector” component.

**Step Three **– Now I want to do the same thing for the columns. All I have to do is use the “Flip Matrix” component to change the way the points are arranged in the data structure, and then do another series of random rotations.

**Step Four – **The last thing to do is to draw a line using the “SDL” component. The **S**tart will be the grid points, the **D**irection will be the rotated vectors, and the **L**ength will be just a variable based on the sliders.

Below are some images of variations based on this script.

The grasshopper script…