In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

1.0 random distribution

"basics in generative art" is a series of articles available here:http://en.nicoptere.net/?p=1180
Get Adobe Flash player
by nicoptere 13 Dec 2010
/**
 * Copyright nicoptere ( http://wonderfl.net/user/nicoptere )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/orjP
 */

package
{
	import flash.geom.Point;
	import flash.geom.Rectangle;
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class RandomDistribution
	{
		
		static public function distribute( rect:Rectangle, count:int = 100  ):Vector.<Point>
		{
			
			var points:Vector.<Point> = new Vector.<Point>();
			var i:int = count;
			while( i-- )
			{
				points.push( new Point( rect.x + Math.random() * rect.width, rect.y + Math.random() * rect.height ) );
			}
			return points;
			
		}
		
	}

}