Return to Snippet

Revision: 12941
at April 1, 2009 23:46 by publicbroadcast


Initial Code
public function getRandomPoint(rectangle){
    var randomX = getRandomInteger(rectangle.left, rectangle.right);
    var randomY = getRandomInteger(rectangle.top, rectangle.bottom);

    return new Point(randomX, randomY);

  function getRandomInteger (min, max) {
    return min + Math.floor(Math.random()*(max + 1 - min));
  }
}

Initial URL

                                

Initial Description

                                

Initial Title
Functional Get Random Point in a Rectangle

Initial Tags

                                

Initial Language
ActionScript 3