function steerForWander (out, boid, random=defaultRng) {
    const center = Pool.malloc()
    vec2.normalize(center, boid.rigidBody.velocity)
    vec2.scale(center, center, boid.steering.wanderDistance)

    const offset = Pool.malloc(boid.steering.wanderRadius, 0)
    vec2.rotate(offset, offset, ORIGIN, boid.steering.wanderAngle)

    boid.steering.wanderAngle += random() * boid.steering.wanderRange - boid.steering.wanderRange * 0.5

    vec2.add(out, center, offset)
    
    Pool.free(offset)
    Pool.free(center)

    return out
}
// wander around, changing angle by a limited amount each tick
wander around, changing angle by a limited amount each tick
wander around changing angle by a limited amount each tick
function steerForWander (out, boid, random=defaultRng) {
    const center = Pool.malloc()
    vec2.normalize(center, boid.rigidBody.velocity)
    vec2.scale(center, center, boid.steering.wanderDistance)
    const offset = Pool.malloc(boid.steering.wanderRadius, 0)
    vec2.rotate(offset, offset, ORIGIN, boid.steering.wanderAngle)
    boid.steering.wanderAngle += random() * boid.steering.wanderRange - boid.steering.wanderRange * 0.5
    vec2.add(out, center, offset)
    Pool.free(offset)
    Pool.free(center)
    return out
}
function steerForWander ( out , boid , random = defaultRng ) { const center = Pool . malloc ( ) vec2 . normalize ( center , boid . rigidBody . velocity ) vec2 . scale ( center , center , boid . steering . wanderDistance ) const offset = Pool . malloc ( boid . steering . wanderRadius , 0 ) vec2 . rotate ( offset , offset , ORIGIN , boid . steering . wanderAngle ) boid . steering . wanderAngle += random ( ) * boid . steering . wanderRange - boid . steering . wanderRange * 0.5 vec2 . add ( out , center , offset ) Pool . free ( offset ) Pool . free ( center ) return out }
wander around, changing angle by a limited amount each tick
wander around changing angle by a limited amount each tick