I want to somehow generate a table of random vectors where the x and y add up to 10, and the z is constant.

To put it into context: i want to add these vectors to the player’s position vector, in order to spawn entities which are 10 units away along a circular path around the player, and have the entities spawn randomly along this circle.

alternatively, if you suggest some simpler way to do this, that would be appreciated too.

well, this is what I have made but it doesn’t work quite right.

```
function spawnent(ply)
local distancevar = 300
local vector = {}
for x=1,distancevar do
y = distancevar-x
vector[x] = y
end
local randomY = table.Random(vector)
local randomX = distancevar-randomY
local setvec = Vector(randomX, randomY,0)
local spawnvec = ply:GetPos() + setvec
print(spawnvec)
local zombie = ents.Create("npc_zombie")
zombie:SetPos(spawnvec)
zombie:Spawn()
end
concommand.Add("spawnent", spawnent)
```

it just spawns them on a random point on a line, rather than in a circle.

http://img46.imageshack.us/img46/7760/gmflatgrass0001r.jpg