Reputation: 9796
How to do I assign turtles in Netlogo random positions at start, with no two turtles being assigned the same patch? Right now I use the following code but it doesn't give distinct patches for each turtle within limits.
setxy ((random (lengthrec - 1) * 2) - (lengthrec - 1)) ((random (breadth - 2) * 2) - (breadth - 2))
Upvotes: 2
Views: 231
Reputation: 9610
Assuming there is a global num-turtles
and that this is smaller than the number of patches:
to create-turtles
ask n-of num-turtles patches [sprout 1]
end
Upvotes: 3