Files
freeCodeCamp/guide/chinese/javascript/standard-objects/math/math-random/index.md
2018-10-16 21:32:40 +05:30

23 lines
400 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Math Random
localeTitle: 数学随机
---
## 数学随机
`Math.random()`返回0包括和1不包括之间的数字。
#### 句法
`Math.random()`
#### 例
```js
function randomInRange(min, max) {
return Math.random() * (max - min) + min;
}
```
#### 更多信息:
[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)