Random mouse clicker

Hi, I would like to know how to make the mouse click randomly inside a specified area for a specified amount of time.

I found a toy called ToneMatrix http://lab.andre-michelle.com/tonematrix which is a music generator. You click, and a tone sounds. Click somewhere else and you get a tone at a different pitch. So the clicker script would click randomly over the area of ToneMatrix in order to generate these tones.

I made a start at a script, got this far and kept crashing Firefox with it, so stopped and came for help.


tell application "System Events"
	tell process "Firefox"
		set x to random number from 250 to 850
		set y to random number from 600 to 1400
		click at {x, y}
	end tell
end tell

I have done some automator scripting and some very light applescript in the past, but really am totally at sea here. Help would be very much appreciated of course. Thanks.

Model: Macbook Pro
AppleScript: 2.0.1
Browser: Firefox 3.0.8
Operating System: Mac OS X (10.5)