mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
125 lines
19 KiB
HTML
125 lines
19 KiB
HTML
<!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>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Dash Core: src/random.h Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(initResizable);
|
|
/* @license-end */</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="bitcoin_logo_doxygen.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Dash Core
|
|
 <span id="projectnumber">0.12.2.1</span>
|
|
</div>
|
|
<div id="projectbrief">P2P Digital Currency</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('random_8h_source.html','');});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">random.h</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="random_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright (c) 2009-2010 Satoshi Nakamoto</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright (c) 2009-2014 The Bitcoin Core developers</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Distributed under the MIT software license, see the accompanying</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// file COPYING or http://www.opensource.org/licenses/mit-license.php.</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> </div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#ifndef BITCOIN_RANDOM_H</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#define BITCOIN_RANDOM_H</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "<a class="code" href="uint256_8h.html">uint256.h</a>"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <stdint.h></span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="keywordtype">void</span> <a class="code" href="random_8h.html#ab699fbdf803610a4e2060fd87787f7e0">RandAddSeed</a>();</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="keywordtype">void</span> <a class="code" href="random_8h.html#a786af12a87491f8dc24351d93b9833b6">RandAddSeedPerfmon</a>();</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keywordtype">void</span> <a class="code" href="random_8h.html#ada0c29949c4d1ac0cc027d93c4771423">GetRandBytes</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* buf, <span class="keywordtype">int</span> num);</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> uint64_t <a class="code" href="random_8h.html#a27d9149d522b1fa87d84e5e9ca902aef">GetRand</a>(uint64_t nMax);</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="keywordtype">int</span> <a class="code" href="random_8h.html#a0e44e088732172da6662db2d5e37d4b2">GetRandInt</a>(<span class="keywordtype">int</span> nMax);</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <a class="code" href="classuint256.html">uint256</a> <a class="code" href="random_8h.html#af3aedae75efabb170337a497457f7ecf">GetRandHash</a>();</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keywordtype">void</span> <a class="code" href="random_8h.html#abef4e13668f53ac5404c796462aed9b4">seed_insecure_rand</a>(<span class="keywordtype">bool</span> fDeterministic = <span class="keyword">false</span>);</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">extern</span> uint32_t <a class="code" href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a>;</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="keyword">extern</span> uint32_t <a class="code" href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a>;</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="random_8h.html#ae8f7a2f188545bbbf746160adc42038e"> 42</a></span> <span class="keyword">static</span> <span class="keyword">inline</span> uint32_t <a class="code" href="random_8h.html#ae8f7a2f188545bbbf746160adc42038e">insecure_rand</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> {</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <a class="code" href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a> = 36969 * (<a class="code" href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a> & 65535) + (<a class="code" href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a> >> 16);</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <a class="code" href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a> = 18000 * (<a class="code" href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a> & 65535) + (<a class="code" href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a> >> 16);</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">return</span> (<a class="code" href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a> << 16) + <a class="code" href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a>;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> }</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classInsecureRand.html"> 52</a></span> <span class="keyword">class </span><a class="code" href="classInsecureRand.html">InsecureRand</a></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> {</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113"> 55</a></span>  uint32_t <a class="code" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">nRz</a>;</div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462"> 56</a></span>  uint32_t <a class="code" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">nRw</a>;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="classInsecureRand.html#ae9bed2d175ff061e26e5596e30305011"> 57</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classInsecureRand.html#ae9bed2d175ff061e26e5596e30305011">fDeterministic</a>;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <a class="code" href="classInsecureRand.html#a1554ac55ef2ad9b78925411a135589ff">InsecureRand</a>(<span class="keywordtype">bool</span> _fDeterministic = <span class="keyword">false</span>);</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classInsecureRand.html#a7d48179092a3acc9e912ad6b53dbd294"> 69</a></span>  int64_t <a class="code" href="classInsecureRand.html#a7d48179092a3acc9e912ad6b53dbd294">operator()</a>(int64_t nMax)</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  {</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <a class="code" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">nRz</a> = 36969 * (<a class="code" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">nRz</a> & 65535) + (<a class="code" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">nRz</a> >> 16);</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <a class="code" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">nRw</a> = 18000 * (<a class="code" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">nRw</a> & 65535) + (<a class="code" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">nRw</a> >> 16);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">return</span> ((<a class="code" href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">nRw</a> << 16) + <a class="code" href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">nRz</a>) % nMax;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> };</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="preprocessor">#endif // BITCOIN_RANDOM_H</span></div><div class="ttc" id="random_8h_html_a786af12a87491f8dc24351d93b9833b6"><div class="ttname"><a href="random_8h.html#a786af12a87491f8dc24351d93b9833b6">RandAddSeedPerfmon</a></div><div class="ttdeci">void RandAddSeedPerfmon()</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00046">random.cpp:46</a></div></div>
|
|
<div class="ttc" id="random_8h_html_a45e4e024616db2e96c5ffc34928c553b"><div class="ttname"><a href="random_8h.html#a45e4e024616db2e96c5ffc34928c553b">insecure_rand_Rw</a></div><div class="ttdeci">uint32_t insecure_rand_Rw</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00122">random.cpp:122</a></div></div>
|
|
<div class="ttc" id="random_8h_html_ab699fbdf803610a4e2060fd87787f7e0"><div class="ttname"><a href="random_8h.html#ab699fbdf803610a4e2060fd87787f7e0">RandAddSeed</a></div><div class="ttdeci">void RandAddSeed()</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00038">random.cpp:38</a></div></div>
|
|
<div class="ttc" id="random_8h_html_ae8f7a2f188545bbbf746160adc42038e"><div class="ttname"><a href="random_8h.html#ae8f7a2f188545bbbf746160adc42038e">insecure_rand</a></div><div class="ttdeci">static uint32_t insecure_rand(void)</div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00042">random.h:42</a></div></div>
|
|
<div class="ttc" id="random_8h_html_a0e44e088732172da6662db2d5e37d4b2"><div class="ttname"><a href="random_8h.html#a0e44e088732172da6662db2d5e37d4b2">GetRandInt</a></div><div class="ttdeci">int GetRandInt(int nMax)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00109">random.cpp:109</a></div></div>
|
|
<div class="ttc" id="classuint256_html"><div class="ttname"><a href="classuint256.html">uint256</a></div><div class="ttdef"><b>Definition:</b> <a href="uint256_8h_source.html#l00114">uint256.h:114</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html_ae9bed2d175ff061e26e5596e30305011"><div class="ttname"><a href="classInsecureRand.html#ae9bed2d175ff061e26e5596e30305011">InsecureRand::fDeterministic</a></div><div class="ttdeci">bool fDeterministic</div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00057">random.h:57</a></div></div>
|
|
<div class="ttc" id="random_8h_html_a27d9149d522b1fa87d84e5e9ca902aef"><div class="ttname"><a href="random_8h.html#a27d9149d522b1fa87d84e5e9ca902aef">GetRand</a></div><div class="ttdeci">uint64_t GetRand(uint64_t nMax)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00094">random.cpp:94</a></div></div>
|
|
<div class="ttc" id="uint256_8h_html"><div class="ttname"><a href="uint256_8h.html">uint256.h</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html"><div class="ttname"><a href="classInsecureRand.html">InsecureRand</a></div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00052">random.h:52</a></div></div>
|
|
<div class="ttc" id="random_8h_html_af3aedae75efabb170337a497457f7ecf"><div class="ttname"><a href="random_8h.html#af3aedae75efabb170337a497457f7ecf">GetRandHash</a></div><div class="ttdeci">uint256 GetRandHash()</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00114">random.cpp:114</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html_a576e38fb46fbdebc9d6daeb546c36113"><div class="ttname"><a href="classInsecureRand.html#a576e38fb46fbdebc9d6daeb546c36113">InsecureRand::nRz</a></div><div class="ttdeci">uint32_t nRz</div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00055">random.h:55</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html_a0baa5d4f04bcb55d1595bf79d8c24462"><div class="ttname"><a href="classInsecureRand.html#a0baa5d4f04bcb55d1595bf79d8c24462">InsecureRand::nRw</a></div><div class="ttdeci">uint32_t nRw</div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00056">random.h:56</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html_a1554ac55ef2ad9b78925411a135589ff"><div class="ttname"><a href="classInsecureRand.html#a1554ac55ef2ad9b78925411a135589ff">InsecureRand::InsecureRand</a></div><div class="ttdeci">InsecureRand(bool _fDeterministic=false)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00141">random.cpp:141</a></div></div>
|
|
<div class="ttc" id="classInsecureRand_html_a7d48179092a3acc9e912ad6b53dbd294"><div class="ttname"><a href="classInsecureRand.html#a7d48179092a3acc9e912ad6b53dbd294">InsecureRand::operator()</a></div><div class="ttdeci">int64_t operator()(int64_t nMax)</div><div class="ttdef"><b>Definition:</b> <a href="random_8h_source.html#l00069">random.h:69</a></div></div>
|
|
<div class="ttc" id="random_8h_html_ada0c29949c4d1ac0cc027d93c4771423"><div class="ttname"><a href="random_8h.html#ada0c29949c4d1ac0cc027d93c4771423">GetRandBytes</a></div><div class="ttdeci">void GetRandBytes(unsigned char *buf, int num)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00086">random.cpp:86</a></div></div>
|
|
<div class="ttc" id="random_8h_html_abef4e13668f53ac5404c796462aed9b4"><div class="ttname"><a href="random_8h.html#abef4e13668f53ac5404c796462aed9b4">seed_insecure_rand</a></div><div class="ttdeci">void seed_insecure_rand(bool fDeterministic=false)</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00123">random.cpp:123</a></div></div>
|
|
<div class="ttc" id="random_8h_html_ad679dcd7cb4960c49a8d400bcc23b0d0"><div class="ttname"><a href="random_8h.html#ad679dcd7cb4960c49a8d400bcc23b0d0">insecure_rand_Rz</a></div><div class="ttdeci">uint32_t insecure_rand_Rz</div><div class="ttdef"><b>Definition:</b> <a href="random_8cpp_source.html#l00121">random.cpp:121</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="random_8h.html">random.h</a></li>
|
|
<li class="footer">Generated on Thu Dec 14 2017 13:15:08 for Dash Core by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|