javascript random() method


  Translation results:

UK[ˈrændəm] US[ˈrændəm]

adj. Random; arbitrary; random

n. Random; accidental action


javascript random() methodsyntax

Function: Returns a random number between 0 ~ 1.

Syntax: Math.random()

Return: A pseudo-random number between 0.0 ~ 1.0.

javascript random() methodexample

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//取得介于 0 到 1 之间的一个随机数
    document.write(Math.random())

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A