Option Explicit '------------------------------------------------------------------------------ ' Subroutine: RandomWalk ' Purpose: typical random walker agent ' Pablo Miranda Carranza, code released ' under GNU General Public License (www.gnu.org/licenses/gpl.txt) '------------------------------------------------------------------------------ Sub RandomWalk() Dim myposition Dim mynextposition(2) Dim heading Dim i Rhino.Print "Starting drawing" Randomize 'initial direction... heading=Array(Rnd-0.5,Rnd-0.5,Rnd-0.5) 'and position myposition=Rhino.getpoint("enter the starting point for the random walk") for i=0 to 100 'we calculate a new heading... heading(0)=heading(0)+ (Rnd-0.5)*0.2 heading(1)=heading(1)+ (Rnd-0.5)*0.2 heading(2)=heading(2)+ (Rnd-0.5)*0.2 'we add it to our position to calculate the next point... mynextposition(0)=myposition(0)+heading(0) mynextposition(1)=myposition(1)+heading(1) mynextposition(2)=myposition(2)+heading(2) 'we draw a line Rhino.addline myposition,mynextposition 'we "move" to the next position, by makin the next position to be the cuurent one myposition(0)=mynextposition(0) myposition(1)=mynextposition(1) myposition(2)=mynextposition(2) next End Sub RandomWalk