# Random Generation of Mildly Irregular Shapes for Cognitive Experiments

## Authors

Nicolas Robidoux and John Cupitt (2010,2011)

## NIP2 workspaces

The first of the following NIP2 workspaces uses a uniform distribution on the square to generate such shapes, the second, a uniform distribution on the disk, and the third, a binormal (Gaussian) distribution:

"start" is the index of the first pair of pseudorandom coordinates to be used, and "npoints" is the number of points to be used for drawing the initial thick polygonal closed curve which, once blurred and thresholded, defines the final black on white shape.

Each of these workspaces uses a list of pairs of groups of 10 digits of pi transformed into real numbers in [0,1) by adding a decimal point in front as a pseudo-random generator:

-- pipoints.csv

Make sure that the workspaces find this file by opening the workspaces with nip2 and opening the file in cell A1 if necessary.

If you want to generate large numbers of such shapes, the following shell scripts may come in handy. Each generates a first shape with 1 random point, a second shape with two random points (different from the first), a third shape with three random points etc:

-- nubatch.sh

-- ndbatch.sh

-- ngbatch.sh

The first shell script uses a pseudo-random sequence of points in the square, the second, a pseudo-random sequence of points in the disk, and the third uses a binormally distributed pseudo-random sequence.

## Sample results (with parameters chosen to make the shapes visually pleasing instead of "natural looking")

Here are some "alphabets" of 26 shapes generated with 16 pseudo-random points in the case of the uniform distributions on the square and disk, and 32 pseudo-random points in the case of the Gaussian distribution. (As usual, groups of 10 digits of pi are used.) These shapes were computed with a threshold value of 13/255, instead of the "100% safe" and more "natural looking" value 5/255.

The shapes drawn from the non-rotationally invariant family generated using the uniform distribution on the square, as well as results with the two uniform distributions generated with fewer seed points (8, say) or larger thresholds, look the most like letters from some sort of alien alphabet. The ones generated using a Gaussian distribution look most "natural." This is typical.