102 lines
5.9 KiB
HTML
102 lines
5.9 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
|
|
<!-- generated by to_html.pl from randomgenerator.xml -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<title>Math.RandomGenerator クラス</title>
|
|
<meta name="author" content="W.Dee" />
|
|
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
<link href="browser.css" type="text/css" rel="stylesheet" title="吉里吉里関連リファレンス用標準スタイル" />
|
|
<link href="mailto:[email protected]" rev="Made" />
|
|
<link href="index.html" target="_top" rel="Start" title="トップページ" />
|
|
</head>
|
|
<body>
|
|
<h1><a id="id290" name="id290">Math.RandomGenerator クラス</a>
|
|
</h1><div class="para"><div>
|
|
Math.RandomGenerator は、<a target="_blank" class="jump" href="http://www.math.keio.ac.jp/~matumoto/emt.html">Mersenne Twister 法</a> による乱数を発生するためのクラスです。<br />
|
|
<br />
|
|
コンストラクタの構文は以下の通りです。
|
|
<br />
|
|
<code class="bq">new Math.RandomGenerator([<乱数種>]);<br />
|
|
</code>
|
|
<br />
|
|
|
|
<br />
|
|
コンストラクタに数値を指定すると、その数値で乱数発生器が初期化されます。<br />
|
|
コンストラクタに serialize メソッドで状態を保存した辞書配列オブジェクトを指定すると、その状態で乱数発生器を作成できます。<br />
|
|
コンストラクタを省略すると、現在時刻を元にした乱数値で乱数発生器が初期化されます (吉里吉里2の場合は現在時刻ではなく、環境ノイズを元にした乱数発生器からの乱数で初期化されます)。<br />
|
|
</div></div>
|
|
<h1><a id="id291" name="id291">randomize</a>
|
|
</h1><div class="para"><div>
|
|
randomize メソッドは、乱数発生器を初期化します。引数はコンストラクタに指定する物と同じです。<br />
|
|
</div></div>
|
|
<h1><a id="id292" name="id292">random</a>
|
|
</h1><div class="para"><div>
|
|
random メソッドは、0以上1.0未満の実数の乱数値を返します。<br />
|
|
</div></div>
|
|
<h1><a id="id293" name="id293">random32</a>
|
|
</h1><div class="para"><div>
|
|
random32 メソッドは、0以上4,294,967,295以下 (0xffffffff 以下) の整数の乱数値を返します。<br />
|
|
</div></div>
|
|
<h1><a id="id294" name="id294">random63</a>
|
|
</h1><div class="para"><div>
|
|
random63 メソッドは、0以上9,223,372,036,854,775,807以下(0x7fffffffffffffff 以下) の整数の乱数値を返します。<br />
|
|
</div></div>
|
|
|
|
<h1><a id="id295" name="id295">random64</a>
|
|
</h1><div class="para"><div>
|
|
random64 メソッドは、-9,223,372,036,854,775,808以上9,223,372,036,854,775,807以下の整数の乱数値を返します。<br />
|
|
</div></div>
|
|
<h1><a id="id296" name="id296">serialize</a>
|
|
</h1><div class="para"><div>
|
|
serialize メソッドは、現在の状態を記録した辞書配列オブジェクトを返します。この辞書配列オブジェクトは、コンストラクタや randomize メソッドに渡すことで、再び現在の状態を再現できる物です。<br />
|
|
</div></div>
|
|
<h1><a id="id297" name="id297">Copyright notice</a>
|
|
</h1><div class="para"><div>
|
|
Mersenne Twister法の実装には<br />
|
|
<br />
|
|
A C-program for MT19937, with initialization improved 2002/2/10.
|
|
Coded by Takuji Nishimura and Makoto Matsumoto.<br />
|
|
<br />
|
|
を改変した物を用いています。有用なプログラムソースを公開なさっている両氏に感謝します。<br />
|
|
<br />
|
|
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,<br />
|
|
All rights reserved.<br />
|
|
<br />
|
|
Redistribution and use in source and binary forms, with or without<br />
|
|
modification, are permitted provided that the following conditions<br />
|
|
are met:<br />
|
|
<br />
|
|
1. Redistributions of source code must retain the above copyright<br />
|
|
notice, this list of conditions and the following disclaimer.<br />
|
|
<br />
|
|
2. Redistributions in binary form must reproduce the above copyright<br />
|
|
notice, this list of conditions and the following disclaimer in the<br />
|
|
documentation and/or other materials provided with the distribution.<br />
|
|
<br />
|
|
3. The names of its contributors may not be used to endorse or promote <br />
|
|
products derived from this software without specific prior written <br />
|
|
permission.<br />
|
|
<br />
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS<br />
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT<br />
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR<br />
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR<br />
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,<br />
|
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<br />
|
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR<br />
|
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF<br />
|
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING<br />
|
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<br />
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br />
|
|
<br />
|
|
</div></div>
|
|
|
|
<script type="text/javascript" charset="UTF-8" src="documentid.js" ></script>
|
|
<script type="text/javascript" charset="UTF-8" src="postcontent.js" ></script>
|
|
</body>
|
|
</html>
|