Author: xiaqqaix@xxxxxxxxx Date: Wed Jan 21 21:29:53 2009 New Revision: 203 Modified: trunk/libs/random/index.html trunk/libs/random/nondet_random.html trunk/libs/random/random-concepts.html trunk/libs/random/random-distributions.html Log: random 库更新 Modified: trunk/libs/random/index.html ============================================================================== --- trunk/libs/random/index.html (original) +++ trunk/libs/random/index.html Wed Jan 21 21:29:53 2009 @@ -119,7 +119,7 @@ </ul>此外,头文件 <code><a href="../../boost/nondet_random.hpp"> <boost/nondet_random.hpp></a></code> 中提供了不确定的随机数生成器;请 阅读其 <a href="nondet_random.html">文档</a>。
- <p>为把生成器界面和分布函数映射到其它概念##上,提供了数个 <a href="random-misc.html">修饰符</a>。</p> + <p>为把生成器界面和分布函数映射到其它概念上,提供了数个 <a href="random-misc.html">修饰符</a>。</p>
<h2>测试</h2> @@ -133,7 +133,7 @@ <h2>历史和致谢</h2>- <p>1999 年 11 月,Jeet Sukumaran 提出了一个基于虚函数的框架,不久做出了一 个基于模板的原型。Ed Brey 指出 Microsoft Visual C++ 不支持类内成员初始化,并 建议采用 <code>enum</code> 来绕过这个问题。Dave Abrahams 指出了量子化问题。 </p> + <p>1999 年 11 月,Jeet Sukumaran 提出了一个基于虚函数的框架,不久做出了一 个基于模板的原型。Ed Brey 指出 Microsoft Visual C++ 不支持类内成员初始化,并 建议采用 <code>enum</code> 来绕过这个问题。Dave Abrahams 指出了量子化 (quantization) 问题。</p>
<p>2000 年 3 月,经过 boost 邮件列表的多方面讨论,决定首次释出本随机数 库。感谢 Beman Dawes 提供最初的 <code>min_rand</code> 类、可移植性修正、文 档建议和一般的指导。Harry Erwin 提供的头文件揭示出了更多的需求。Ed Brey 和 Beman Dawes 提出需要一个类迭代器的界面。</p>
@@ -160,7 +160,7 @@ accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href= "http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> - <p>中文版修订:2008/6/23</p> + <p>中文版修订:2009/1/21</p><p><i>Copyright © 2008 <a href="http://wiki.woodpecker.org.cn/moin/XiaoQi";>xiaq</a></i></p>
Modified: trunk/libs/random/nondet_random.html ============================================================================== --- trunk/libs/random/nondet_random.html (original) +++ trunk/libs/random/nondet_random.html Wed Jan 21 21:29:53 2009 @@ -4,26 +4,23 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Boost RNG Library - Non-Deterministic Random Number - Generators</title> + <title>Boost 随机数库:不确定随机数生成器</title> </head> <body bgcolor="#FFFFFF" text="#000000"><h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="middle"
- width="277" height="86">Header <a href= - "../../boost/nondet_random.hpp"><boost/nondet_random.hpp></a></h1>+ width="277" height="86"><a href="../../boost/nondet_random.hpp"><boost/nondet_random.hpp></a> 头 文件</h1>
<ul> - <li><a href="#synopsis">Synopsis</a></li> + <li><a href="#synopsis">概览</a></li> - <li><a href="#random_device">Class <code>random_device</code></a></li> + <li><a href="#random_device"><code>random_device</code> 类</a></li> - <li><a href="#performance">Performance</a></li> + <li><a href="#performance">性能</a></li> </ul> <h2><a name="synopsis" id= - "synopsis">Header</a><code><boost/nondet_random.hpp></code> - Synopsis</h2>+ "synopsis"></a><code><boost/nondet_random.hpp></code> 头文件概览 </h2>
<pre> namespace boost { class random_device; @@ -33,7 +30,7 @@ <h2><a name="random_device" id="random_device">Class <code>random_device</code></a></h2> - <h3>Synopsis</h3> + <h3>概览</h3> <pre> class random_device : noncopyable { @@ -51,32 +48,21 @@ }; </pre> - <h3>Description</h3> + <h3>描述</h3> - <p>Class <code>random_device</code> models a <a href= - "random-concepts.html#nondet-rng">non-deterministic random number - generator</a>. It uses one or more implementation-defined stochastic- processes to generate a sequence of uniformly distributed non-deterministic
- random numbers. For those environments where a non-deterministic random - number generator is not available, class <code>random_device</code> must - not be implemented. See</p>+ <p><code>random_device</code> 类是 <a href="random-concepts.html#nondet-rng">不确定随机数生成器</a> 的模型。它使用 一个或多个实现定义的随机过程来生成均匀分布的不确定随机数的序列。如果环境中没 有可用的不确定随机数生成器,就不应当实现 <code>random_device</code> 类。关于 本主题的更多讨论,参看</p>
<blockquote> "Randomness Recommendations for Security", D. Eastlake, S. Crocker, J. Schiller, Network Working Group, RFC 1750, December 1994 - </blockquote>for further discussions. + </blockquote>。 - <p><em>Note:</em> Some operating systems abstract the computer hardware - enough to make it difficult to non-intrusively monitor stochastic - processes. However, several do provide a special device for exactly this - purpose. It seems to be impossible to emulate the functionality using - Standard C++ only, so users should be aware that this class may not be - available on all platforms.</p>+ <p><em>注意:</em>有的操作系统对计算机硬件的抽象使得监测随机过程十分困 难;而有的系统提供了专门用于这一目的的设备。只使用标准 C++ 实现不确定随机数 生成器在现在看来是不可能的;因此用户应当注意,这一类在有些平台上是不可用的。 </p>
- <h3>Members</h3> + <h3>成员</h3> <pre> explicit random_device(const std::string& token = default_token) -</pre><strong>Effects:</strong> Constructs a <code>random_device</code>, +</pre><strong>效果:</strong> Constructs a <code>random_device</code>,optionally using the given <code>token</code> as an access specification (for
example, a URL) to some implementation-defined service for monitoring a stochastic process. @@ -100,7 +86,7 @@ <code>/dev/random</code> pseudo-device, which blocks on reads if the entropy pool has no more random bits available.</p> - <h2><a name="performance" id="performance">Performance</a></h2> + <h2><a name="performance" id="performance">性能</a></h2> <p>The test program <a href= "nondet_random_speed.cpp">nondet_random_speed.cpp</a> measures the @@ -141,5 +127,10 @@ accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href= "http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> + <p>中文版修订:2009/1/21</p> ++ <p><i>Copyright © 2008 <a href="http://wiki.woodpecker.org.cn/moin/XiaoQi";>xiaq</a></i></p>
++ <p><i>在 Boost Software License, Version 1.0 的条款下发布。(参看文件 <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> 或在线副本 <a href="http://www.boost.org/LICENSE_1_0.txt";> http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
</body> </html> Modified: trunk/libs/random/random-concepts.html ============================================================================== --- trunk/libs/random/random-concepts.html (original) +++ trunk/libs/random/random-concepts.html Wed Jan 21 21:29:53 2009 @@ -15,7 +15,7 @@ <p>许多应用领域都需要用到随机数,例如:</p> <ul> - <li>数字控制 (模拟, Monte-Carlo 法) + <li>数字控制 (模拟, Monte-Carlo 算法) <li>游戏 (敌人的行为应该是不确定的)</li> @@ -52,7 +52,7 @@ <li>提供尽可能高的效率</li> - <li>控制前端处理中的量子化问题 (未完成)</li> + <li>控制前端处理中的量子化 (quantization) 问题 (未完成)</li> </ul><h2><a name="number_generator" id="number_generator">数字生成器 (Number Generator)</a></h2>
@@ -242,7 +242,7 @@<p><em>注意:</em>此类伪随机数生成器可用于数字控制、游戏和测试。取不少于 一个参数的构造函数和 <code>seed()</code> 成员函数可以让用户设定状态;在调试 Monte-Carlo 算法、分析特定的测试场景 (test scenario) 时这是很有用的。 Streamable 概念允许保存和恢复生成器的状态,例如隔一段时间后重新运行某一测试 套件。</p>
- <h2><a name="random-dist" id="random-dist">随机分布</a></h2>+ <h2><a name="random-dist" id="random-dist">随机分布 (Random Distribution)</a></h2>
<p>随机分布取均匀分布的随机值作为输入,输出符合某一分布的随机数。下表 中,<code>X</code> 是返回 <code>T</code> 类型的随机分布类,<code>u</code> 是 <code>X</code> 的实例,<code>x</code> 是 <code>X</code> 的实例 (可为 const),<code>e</code> 是任一均匀随机数生成器类型的左值,返回类型是 <code>U</code>。</p>
@@ -317,7 +317,7 @@<p>附加需求:反复调用 <code>x(e)</code> 产生的序列不应因调用 <code>os << x</code> 而改变;用 <code>os << x</code> 保存,并用 <code>is >> y</code> 恢复到同一或另一对象 <code>y</code> 后,反复调用 <code>y(e)</code> 产生的序列应该和原序列相同。</p>
- <h2><a name="quasi-rng" id="quasi-rng">拟随机数生成器</a></h2>+ <h2><a name="quasi-rng" id="quasi-rng">拟随机数生成器 (Quasi-Random Number Generators)</a></h2>
<p>一个拟随机数生成器是一个 NumberGenerator,它根据某一算法和内部状态提供 确定的数字序列。产生的数字不具有统计学性质 (例如正态分布或各值互相独立)。 </p>
@@ -341,7 +341,7 @@ accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href= "http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</a>)</i></p> - <p>中文版修订:2008/6/26</p> + <p>中文版修订:2008/1/21</p><p><i>Copyright © 2008 <a href="http://wiki.woodpecker.org.cn/moin/XiaoQi";>xiaq</a></i></p>
Modified: trunk/libs/random/random-distributions.html ============================================================================== --- trunk/libs/random/random-distributions.html (original) +++ trunk/libs/random/random-distributions.html Wed Jan 21 21:29:53 2009 @@ -82,7 +82,7 @@ <td>实数区间 [min, max) 上的连续均匀分布</td>- <td>随机投下一木棒,其角度的弧度数是 [0, 2pi) 上的这种分布 (假设角度 的分布是均匀的)</td> + <td>随机投下一木棍,其偏转角的弧度数是 [0, 2pi) 上的这种分布 (假设角 度的分布是均匀的)</td>
</tr> <tr> @@ -98,7 +98,7 @@ <td><code><a href= "#geometric_distribution">geometric_distribution</a></code></td> - <td>重复伯努利试验,直到出现某一结果的试验次数</td> + <td>几何分布:重复伯努利试验,直到出现某一结果的试验次数</td> <td>抛掷骰子,记录“6”首次出现时的试验次数</td> </tr> @@ -116,7 +116,7 @@ <td><code><a href= "#exponential_distribution">exponential_distribution</a></code></td> - <td>质数分布</td> + <td>指数分布</td> <td>放射性物质发射 alpha 粒子的间隔时间</td> </tr> @@ -125,7 +125,7 @@ <td><code><a href= "#normal_distribution">normal_distribution</a></code></td> - <td>无穷次重复伯努利试验的结果计数</td> + <td>正态分布:无穷次重复伯努利试验的结果计数</td> <td>投掷硬币 10000 次,记录正面出现的次数</td> </tr> @@ -143,10 +143,9 @@ <td><code><a href= "#uniform_on_sphere">uniform_on_sphere</a></code></td> - <td>uniform distribution on a unit sphere of arbitrary dimension</td> + <td>在任意给定维数空间的球形上的均匀分布</td>- <td>choosing a random point on Earth (assumed to be a sphere) where to
- spend the next vacations</td> + <td>在地球上任取一点度假 (假设地球是球形)</td> </tr> </table> @@ -155,7 +154,7 @@ <ul> <li>内部随机数生成器</li>- <li>If applicable, return type, with a default to a reasonable type.</li>
+ <li>(可能无这一参数) 返回值,其默认值为某一恰当的类型</li> </ul> <p><em>The distribution functions no longer satisfy the input iterator @@ -235,13 +234,10 @@ <h3>描述</h3>- <p>分布函数 <code>uniform_smallint</code> 是 <a href="random-concepts.html#random-dist">随机分布</a> 的模型。每次调用都将返 回在整数集 {min, min+1, min+2, ..., max} 上均匀分布的随机整数。它假设目的区 间长度 (max-min+1) 比内部随机数源小得多,因此不考虑量子化问题。</p> + <p>分布函数 <code>uniform_smallint</code> 是 <a href="random-concepts.html#random-dist">随机分布</a> 的模型。每次调用都将返 回在整数集 {min, min+1, min+2, ..., max} 上均匀分布的随机整数。它假设目的区 间长度 (max-min+1) 比内部随机数源小得多,因此不考虑量子化 (quantization) 问 题。</p>
- <p>令 r<sub>out</sub>=(max-min+1) 为目的区间长度,r<sub>base</sub> 为随机 数源的区间长度。Then, for the uniform distribution, the theoretical probability - for any number i in the range r<sub>out</sub> will be p<sub>out</sub>(i) =
- 1/r<sub>out</sub>. Likewise, assume a uniform distribution on - r<sub>base</sub> for the underlying source of random numbers, i.e. - p<sub>base</sub>(i) = 1/r<sub>base</sub>. Let p<sub>out_s</sub>(i) denote+ <p>令 r<sub>out</sub>=(max-min+1) 为目的区间,r<sub>base</sub> 为随机数源 的区间 (译注:这里的 r 同时用来表示区间及其宽度)。今要求产生一均匀分布,即对 区间 r<sub>out</sub> 中的任意数,其概率都将是 p<sub>out</sub>(i) = 1/r<sub>out</sub>。类似地,内部随机数源产生均匀分布,也即对 r<sub>base</sub> 中的任意数,其概率均为 p<sub>base</sub>(i) = 1/r<sub>base</sub>。
+ Let p<sub>out_s</sub>(i) denote the random distribution generated by <code>uniform_smallint</code>. Then the sum over all i in r<sub>out</sub> of (p<sub>out_s</sub>(i)/p<sub>out</sub>(i) -1)<sup>2</sup> shall not exceed