1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
<!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">
<head>
<title>Class Poco::Random</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class Random</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Crypt<br />
<b>Header:</b> Poco/Random.h</p>
<h2>Description</h2>
<div class="description">
<p>A better random number generator. <a href="Poco.Random.html" title="class Poco::Random">Random</a> implements a pseudo random number generator (PRNG). The PRNG is a nonlinear additive feedback random number generator using 256 bytes of state information and a period of up to 2^69. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Random.html#9630" title="Poco::Random::goodRand()">goodRand</a>, <a href="Poco.Random.html#9626" title="Poco::Random::initState()">initState</a>, <a href="Poco.Random.html#9619" title="Poco::Random::next()">next</a>, <a href="Poco.Random.html#9623" title="Poco::Random::nextBool()">nextBool</a>, <a href="Poco.Random.html#9622" title="Poco::Random::nextChar()">nextChar</a>, <a href="Poco.Random.html#9625" title="Poco::Random::nextDouble()">nextDouble</a>, <a href="Poco.Random.html#9624" title="Poco::Random::nextFloat()">nextFloat</a>, <a href="Poco.Random.html#9616" title="Poco::Random::seed()">seed</a></p>
<h2>Enumerations</h2>
<h3><a name="9607">Type</a></h3>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="9608">RND_STATE_0</a> = 8</p>
<div class="description">
<p>linear congruential </p>
</div>
<p class="decl"><a name="9609">RND_STATE_32</a> = 32</p>
<div class="description">
<p>x**7 + x**3 + 1 </p>
</div>
<p class="decl"><a name="9610">RND_STATE_64</a> = 64</p>
<div class="description">
<p>x**15 + x + 1 </p>
</div>
<p class="decl"><a name="9611">RND_STATE_128</a> = 128</p>
<div class="description">
<p>x**31 + x**3 + 1 </p>
</div>
<p class="decl"><a name="9612">RND_STATE_256</a> = 256</p>
<div class="description">
<p>x**63 + x + 1 </p>
</div>
<h2>Constructors</h2>
<h3><a name="9613">Random</a></h3>
<p class="decl"><a href="Poco.Random.html" title="class Poco::Random">Random</a>(<br /> int stateSize = 256<br />);</p>
<div class="description">
<p>Creates and initializes the PRNG. Specify either a state buffer size (8 to 256 bytes) or one of the <a href="Poco.Random.html#9607" title="enum Poco::Random::Type">Type</a> values. </p>
</div>
<h2>Destructor</h2>
<h3><a name="9615">~Random</a></h3>
<p class="decl">~<a href="Poco.Random.html" title="class Poco::Random">Random</a>();</p>
<div class="description">
<p>Destroys the PRNG. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="9619">next</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> next();</p>
<div class="description">
<p>Returns the next 31-bit pseudo random number. </p>
</div>
<h3><a name="9620">next</a></h3>
<p class="decl"><a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> next(<br /> <a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> n<br />);</p>
<div class="description">
<p>Returns the next 31-bit pseudo random number modulo n. </p>
</div>
<h3><a name="9623">nextBool</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool nextBool();</p>
<div class="description">
<p>Returns the next boolean pseudo random value. </p>
</div>
<h3><a name="9622">nextChar</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">char nextChar();</p>
<div class="description">
<p>Returns the next pseudo random character. </p>
</div>
<h3><a name="9625">nextDouble</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">double nextDouble();</p>
<div class="description">
<p>Returns the next double pseudo random number between 0.0 and 1.0. </p>
</div>
<h3><a name="9624">nextFloat</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">float nextFloat();</p>
<div class="description">
<p>Returns the next float pseudo random number between 0.0 and 1.0. </p>
</div>
<h3><a name="9616">seed</a></h3>
<p class="decl">void seed(<br /> <a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> seed<br />);</p>
<div class="description">
<p>Seeds the pseudo random generator with the given seed. </p>
</div>
<h3><a name="9618">seed</a></h3>
<p class="decl">void seed();</p>
<div class="description">
<p>Seeds the pseudo random generator with a random seed obtained from a <a href="Poco.RandomInputStream.html" title="class Poco::RandomInputStream">RandomInputStream</a>. </p>
</div>
<h3><a name="9630">goodRand</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> goodRand(<br /> <a href="Poco.html#11353" title="Poco::Int32">Int32</a> x<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="9626">initState</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void initState(<br /> <a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> seed,<br /> char * arg_state,<br /> <a href="Poco.html#11353" title="Poco::Int32">Int32</a> n<br />);</p>
<div class="description">
<p></p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|