random
Pick a random position inside a cube shaped space. Use the shorthand randpos instead.
positions.random(
pos(0, 0, 0),
pos(0, 0, 0)
);
You set the corners of the space (volume) where the random position is chosen. The corners determine where, and how big, the cube shaped space is.
Parameters
- p1: the position of the first corner of the cube.
- p2: the position of the opposite corner of the cube.
Example
Spawn chickens at random positions above the player’s head.
for (let i = 0; i < 10; i++) {
mobs.spawn(CHICKEN, randpos(
pos(-3, 5, -3),
pos(3, 10, 3)
));
}