This seems to work: Make a stack with a button having this script, then click the button. It will bounce around in a normal distribution in H and V coordinates.
on mouseUp local tSD,tMean,tPoint,tStartPoint put the loc of me into tStartPoint put the width of this window div 6 & comma & the height of this window div 6 into tSD put the width of this window div 2 & comma & the height of this window div 2 into tMean put BoxMullerDist(tMean,tSD) into tPoint set the loc of me to tPoint wait 1 second set the loc of me to tStartPoint end mouseUp function BoxMullerDist pMean,pStdDev local tU,tV,tX,tY put random(100)/100 into tU put random(100)/100 into tV put sqrt(-2*ln(tU))*cos(2*pi*tV) into tX put sqrt(-2*ln(tU))*sin(2*pi*tV) into tY return item 1 of pMean + tX*item 1 of pStdDev & comma & item 2 of pMean + tY*item 2 of pStdDev end BoxMullerDist You can tweak the range by setting tSD to div 4 to hit the edges more often. You can tweak the center point by shifting the mean, but you will go off the edges sometimes if you shift too far. Ref: http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution Walt Sumner _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode