---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Math.random()

The **`Math.random()`** function returns a floating-point, pseudo-random number that's greater than or equal to 0 and less than 1, with approximately uniform distribution over that range — which you can then scale to your desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.

> **Note:** `Math.random()` _does not_ provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the `crypto.getRandomValues()` method.

## Syntax

```js
Math.random()
```

### Return value

A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive).
