How to automate creating something like this?

 From:  chippwalters
8088.16 
Hi Michael,

Checked out your Randomize Script.

Created an array of 10mm cubes 30 x 30 = 900 cubes in all. Set it to randomize height only between 5-10mm.

Tested on my Mac Mini i5 (not terribly fast). Older version took just over 75 seconds.

New version < 1 second. Not bad for optimization :-)