---
title: "random | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function random

-   random(out: [vec3](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.vec3/), scale?: number): [vec3](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.vec3/)[](#random)
    
    Generates a random vector with the given scale
    
    #### Parameters
    
    -   out: [vec3](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.vec3/)
        
        the receiving vector
        
    -   `Optional`scale: number
        
        Length of the resulting vector. If omitted, a unit vector will be returned
        
    
    #### Returns [vec3](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.vec3/)
    
    out
