⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swarm.random.sgml.reference.html

📁 set for Swarm2.1是圣菲研究院的开发人员对Swarm的特性及其使用描述的最为完备的指南性文档。从这里可以获得最细致的平台说明。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<HTML><HEAD><TITLE>Random Library</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Reference Guide for Swarm 2.1.1"HREF="book930.html"><LINKREL="PREVIOUS"TITLE="General"HREF="swarm.objectbase.generic.module.html"><LINKREL="NEXT"TITLE="ACGgen"HREF="swarm.random.acggen.protocol.html"></HEAD><BODYCLASS="REFERENCE"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.objectbase.generic.module.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.random.acggen.protocol.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="REFERENCE"><ANAME="SWARM.RANDOM.SGML.REFERENCE"></A><DIVCLASS="TITLEPAGE"><H1CLASS="TITLE">V. Random Library</H1><DIVCLASS="PARTINTRO"><ANAME="AEN12878"></A><TABLECLASS="SIDEBAR"BORDER="1"CELLPADDING="5"><TR><TD><DIVCLASS="SIDEBAR"><P><B>Overview</B></P><P>First, a few thoughts on random number generation. It's hard      to do right! The root cause, of course, is that computer      algorithms themselves are not truly random. (Hence this library      contains pseudo-random generators only.)      There are many problems in implementing algorithms correctly and      efficiently, and in coming up with good tests for generators and      distributions. The history of pseudorandom number generation in      simulation work is mostly embarrassing. This library attempts to      do a decent job of generating random numbers, as well as      documenting how things work and what shortcomings there are.      If you want to learn more about random number generation, the      bibliography in the <AHREF="http://www.swarm.org"TARGET="_top"><ICLASS="CITETITLE">Swarm User Guide</I></A> has useful notes.  Knuth is the      main reference in this realm, but too old to describe most of      the particular generators used here, many of which are drawn      from recent literature.    </P></DIV></TD></TR></TABLE><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.RANDOM.SGML.SECT1.DEPEND">1. Dependencies</A></H1><P>Following are the other header files imported by    &lt;random.h&gt;:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">#import &lt;objectbase.h&gt;#import &lt;random/generators.h&gt;#import &lt;random/distributions.h&gt;#import &lt;random/randomdefs.h&gt;#import &lt;random/randomvars.h&gt;</PRE></TD></TR></TABLE><P>The <ICLASS="EMPHASIS">objectbase</I> library interface is      included to provide the basic object      support. <TTCLASS="FILENAME">randomdefs.h</TT> contains some C      preprocessor macros and typedefs used in the library.</P><P>This reference guide contains the object definitions      for generators and distributions (see the list above)       and also encodes the      inheritance structure through the "Protocols that this protocol      uses" section of each protocol.       Just click on a (sub-)protocol name to see what methods it      implements. (You may want to review the section on Protocols in      the Objective-C book here!)    </P><P>In the protocols described, any protocol that ultimately      inherits from CREATABLE defines an object that you can use in      your program. (This is part of the Swarm defobj machinery.) In      other words, while 'InternalState' is a normal protocol (a list      of method definitions), the name `ACGgen' refers to both a      protocol and a class that implements that protocol. Similarly,       'GammaDist' defines both a protocol and a class that implements       that protocol.</P><P>All generators and distributions ultimately inherit from      SwarmObject.</P></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.RANDOM.SGML.SECT1.COMPAT">2. Compatibility</A></H1><P></P><UL><LI><DIVCLASS="FORMALPARA"><P><B>1.0.2 -&gt; 1.0.3. </B><ICLASS="EMPHASIS">Note:</I> The new random library does            not work in the same way as the old one. This means that            some applications that used the random library provided            with the 1.0.2 release will be            <ICLASS="EMPHASIS">broken</I>.  However, porting these            applications to the new random library will be fairly easy            since large efforts were made to adhere to the standard            set with the last version and some backwards compatibility            hooks were incorporated.          </P></DIV></LI><LI><DIVCLASS="FORMALPARA"><P><B>1.0, 1.1, 1.2, 1.3, 1.3.1, 1.4. </B>There were no major compatibility issues in these            releases.          </P></DIV></LI></UL></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.RANDOM.SGML.SECT1.USAGE">3. Usage Guide</A></H1><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN12909">3.1. Overview</A></H2><P>The <ICLASS="EMPHASIS">random</I> library contains two kinds        of objects, the <ICLASS="EMPHASIS">generators</I> which implement        different pseudo-random-number algorithms, and the         <ICLASS="EMPHASIS">distributions</I> which transform the (uniform)        output from the generators into the desired simulated statistical        distributions. (The Swarm random library does not         implement any <ICLASS="EMPHASIS">true</I> random number generators         at this time.)      </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN12916">3.2. Usage Guide for Beginners, Advanced Usage Guide and        Guide to Generators and Distributions</A></H2><P>All these sections have been relocated to the        <AHREF="http://www.swarm.org"TARGET="_top"><ICLASS="CITETITLE">Swarm User Guide</I></A></P></DIV></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.RANDOM.SGML.SECT1.SUBCLASS">4. Subclassing Reference</A></H1><P>Random library objects do not do anything exotic during the      create phase. The competent programmer may subclass these objects      in the normal manner.    </P></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.RANDOM.SGML.SECT1.IMPL">5. Implementation Notes</A></H1><P>This section provides implementation details for the current      version of the random library.    </P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN12927">5.1. General Implementation Notes</A></H2><P>This is release 1.4.1 of the Swarm libraries. It contains version0.8 of the random-number library and version 0.81 of the random librarydocumentation. </P><P>Look at the <AHREF="swarm.random.sgml.reference.html">RandomLibrary Reference</A> for the objects defined in thislibrary.</P><DIVCLASS="FORMALPARA"><P><B>`Fat' vs. `Thin' doubles. </B>Note that distributions which use floating point variates fromtheir generators by default draw `fat' doubles (-getDoubleSample)which use two calls to the basic (32-bit) unsigned int sample method(-getUnsignedSample) in order to fill the 53-bit mantissa of a double.If you don't need this much precision, or want to speed up thedistributions, you can make the distributions use `thin' samples(-getThinDoubleSample) instead. See the note at the top of<TTCLASS="FILENAME">random/distributions.h</TT> for how to change thisbehavior. If you do, be sure to remake Swarm(<TTCLASS="USERINPUT"><B>make</B></TT>, <TTCLASS="USERINPUT"><B>make install</B></TT>).</P></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN12938">5.2. Implementation notes for Generators</A></H2><DIVCLASS="FORMALPARA"><P><B>Version 0.8: Changes since version 0.75. </B><P></P><OLTYPE="1"><LI><P>The code was rearranged to conform to create-phaseprotocol (CREATING-SETTING-USING) ordering.</P></LI><LI><P>Some for-loop indices were changed to unsignedintegers to eliminate compiler warnings.</P></LI><LI><P>A few objects (C2LCGXgen, C4LCGXgen, SWBgen, TGFSRgen)were given their own -drop methods to drop internally allocated arraysproperly.</P></LI><LI><P>A new -reset method was added to all generators. Thismethod resets the state of the generator to what it was at creation,or at the point when -setStateFromSeed(s) was last used. Counters arealso reset.</P></LI></OL> </P></DIV><DIVCLASS="FORMALPARA"><P><B>Version 0.75: Changes since version 0.7. </B><P></P><OLTYPE="1"><LI><P>The method '-getDoubleSample' was redefined to useonly double variables in its implementation (instead of long doubles).</P></LI><LI><P>The macros used for starting seed generation werechanged to avoid a situation where many new generators would be createdthe same starting seed (if '--varyseed' was not specified.) See theGenerator Usage Guide and the Reference Guide for details.</P></LI></OL> </P></DIV><DIVCLASS="FORMALPARA"><P><B>Version 0.7: Improvements over version 0.6. </B><P></P><UL><LI><P>A host of new generators, located on the web or in theliterature, have been added since the last version of Random. There isnow a total of 36 different generators defined! Some of these haveimmense periods, some are very fast, and some have much betterstatistical properties than the old generators.</P></LI><LI><P>A new *type* of generator, the `split' generator, hasbeen introduced in the form of L'Ecuyer's C2LCGXgen and C4LCGXgengenerators.</P></LI><LI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -