Math.random

乱数を得る

構文

Math.random()

例文

<html>
<head>
<title>Math.random</title>
</head>

<body>

<!--乱数を得るのサンプル-->
<script type="text/javascript">
document.write(Math.random()+"<br>");
document.write(parseInt(Math.random()*100)); // 0〜100までのランダム数を得る
</script>

</body>
</html>

関連記事

スポンサーリンク

trac プロジェクト管理とバグ追跡のためのツール

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る