# Math.random()

A method that returns a pseudorandom double from 0.0 up to, but not including, 1.0.

## What does **Math.random()** do in JavaScript?

**Math.random()** — A method that returns a pseudorandom double from 0.0 up to, but not including, 1.0.

```javascript
const roundedPrice = Math.round(4.6);
const sample = Math.random();
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: September 27, 2026

## In other subjects

- [Math.random() in Java](https://www.ask-codey.com/glossary/math-random)

Source: https://www.ask-codey.com/glossary/math-random-javascript
