---
title: "JavaScript:random method"
author: "ilusm"
date: "2008-08-25T10:31:54Z"
tags: []
slug: "javascript-random-method"
draft: false
lastmod: "2008-08-25T10:31:54Z"
id: 232265
url: "https://ilusm.iteye.com/blog/232265"
---

## random method

Returns a pseudo-random number between zero and one. This method is available on Unix platforms only.

### 语法

Math.random()

### Method of

Math

### 例子

```
//Displays a random number between 0 and 1
document.write("The random number is " + Math.random())
```