0以上1未満の擬似乱数を返します.
Math.random()
以下にrandomメソッドを使用したサンプルコードを示します.
<html>
<head>
<title>randomメソッドのサンプルコード</title>
</head>
<body>
<script type="text/javascript" language="javascript">
document.write(Math.random());
</script>
</body>
</html>
サンプルコードの実行結果は以下のようになります.
0.5269545202552427
スポンサード リンク