# SetCoordinates randomizer

Oolites AI function setCoordinates: needs 4 parameters separated with a space, like: "setCoordinates: wpu 0 0 0.8" what means a point at 80% of the line witchSpaceEntryPoint to planet.

Giles added a possibility to introduce randomize numbers in each of the coordinates separately. For this you must add a "rand:" in front of the coordinate without an additional space.

rand: is a function with a lot of limitations. It first turns the number into an integer. Then calculates that many random numbers as the value of the integer is large. It adds all the random numbers and divides the answer by the original integer. This gives as result a real value between 0 and 1.

Calculating a random function this way will give a truly random value with a starting value of one. The more random values you add the more likely it becomes to get a value near the center of 0.5 So use is limited to coordinate systems were you can work with results between 0 and 1 but it still leaves some useful use.

e.g.:

``` "setCoordinates: wpu 0 0 rand:1"
```

This will set a random coordinate anywhere on the line witchSpaceEntryPoint to planet.

or

``` "setCoordinates: pwr rand:1 rand:1 6"
```

This will set a point at 6 planet radii from he planet whit a deviation of maximal 1 planet radii on the line: witchSpaceEntryPoint to planet.