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

📄 random_8h-source.html

📁 pwlib开发文档
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>random.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>random.h</h1><a href="random_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * random.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * ISAAC random number generator by Bob Jenkins.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 1993-2000 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Contributor(s): ______________________________________.</span>00025 <span class="comment"> *</span>00026 <span class="comment"> * $Log: random.h,v $</span>00027 <span class="comment"> * Revision 1.4  2002/09/16 01:08:59  robertj</span>00028 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00029 <span class="comment"> *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00030 <span class="comment"> *</span>00031 <span class="comment"> * Revision 1.3  2001/03/03 05:12:47  robertj</span>00032 <span class="comment"> * Fixed yet another transcription error of random number generator code.</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Revision 1.2  2001/02/27 03:33:44  robertj</span>00035 <span class="comment"> * Changed random number generator due to licensing issues.</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.1  2000/02/17 12:05:02  robertj</span>00038 <span class="comment"> * Added better random number generator after finding major flaws in MSVCRT version.</span>00039 <span class="comment"> *</span>00040 <span class="comment"> */</span>00041 00042 <span class="preprocessor">#ifndef _PRANDOM</span>00043 <span class="preprocessor"></span><span class="preprocessor">#define _PRANDOM</span>00044 <span class="preprocessor"></span>00045 00046 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00047 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00048 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00049 <span class="preprocessor"></span>00050 00051 <a name="l00068"></a><a class="code" href="classPRandom.html">00068</a> <span class="keyword">class </span><a class="code" href="classPRandom.html">PRandom</a>00069 {00070   <span class="keyword">public</span>:00075     <a class="code" href="classPRandom.html#a0">PRandom</a>();00076 00081     <a class="code" href="classPRandom.html#a0">PRandom</a>(00082       DWORD seed    00083     );00084 00087     <span class="keywordtype">void</span> <a class="code" href="classPRandom.html#a2">SetSeed</a>(00088       DWORD seed    00089     );00090 00095     <span class="keywordtype">unsigned</span> <a class="code" href="classPRandom.html#a3">Generate</a>();00096 <a name="l00099"></a><a class="code" href="classPRandom.html#a4">00099</a>     <span class="keyword">inline</span> <a class="code" href="classPRandom.html#a4">operator unsigned</a>() { <span class="keywordflow">return</span> <a class="code" href="classPRandom.html#a3">Generate</a>(); }00100 00101 00106     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classPRandom.html#d0">Number</a>();00107 00108 00109   <span class="keyword">protected</span>:00110     <span class="keyword">enum</span> {00111       <a class="code" href="classPRandom.html#t2t0">RandBits</a> = 8, <span class="comment">// I recommend 8 for crypto, 4 for simulations</span>00112       <a class="code" href="classPRandom.html#t2t1">RandSize</a> = 1&lt;&lt;<a class="code" href="classPRandom.html#t2t0">RandBits</a>00113     };00114 <a name="l00115"></a><a class="code" href="classPRandom.html#n0">00115</a>     DWORD <a class="code" href="classPRandom.html#n0">randcnt</a>;<a name="l00116"></a><a class="code" href="classPRandom.html#n1">00116</a>     DWORD <a class="code" href="classPRandom.html#n1">randrsl</a>[<a class="code" href="classPRandom.html#t2t1">RandSize</a>];<a name="l00117"></a><a class="code" href="classPRandom.html#n2">00117</a>     DWORD <a class="code" href="classPRandom.html#n2">randmem</a>[<a class="code" href="classPRandom.html#t2t1">RandSize</a>];<a name="l00118"></a><a class="code" href="classPRandom.html#n3">00118</a>     DWORD <a class="code" href="classPRandom.html#n3">randa</a>;<a name="l00119"></a><a class="code" href="classPRandom.html#n4">00119</a>     DWORD <a class="code" href="classPRandom.html#n4">randb</a>;<a name="l00120"></a><a class="code" href="classPRandom.html#n5">00120</a>     DWORD <a class="code" href="classPRandom.html#n5">randc</a>;00121 };00122 00123 00124 <span class="preprocessor">#endif  // _PRANDOM</span>00125 <span class="preprocessor"></span>00126 00127 <span class="comment">// End Of File ///////////////////////////////////////////////////////////////</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:11 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>

⌨️ 快捷键说明

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