Warcraft III resources & community, 2003–2006 · archived

GetRandomLocInCircle

not rated
Submitted by AIAndyCalculations0 downloads
Computes a random point in a circle with equal distribution.

Source

function GetRandomLocInCircle takes location center, real radius returns location
  local real dist = SquareRoot(GetRandomReal(0,1))*radius
  local real angle = GetRandomReal(0,2*bj_PI)
  return Location(GetLocationX(center)+dist*Cos(angle), GetLocationY(center)+dist*Sin(angle))
endfunction

Comments

0

No comments.