<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bci2000.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Reference%3ARandomGenerator_Class</id>
	<title>Programming Reference:RandomGenerator Class - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.bci2000.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Reference%3ARandomGenerator_Class"/>
	<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;action=history"/>
	<updated>2026-06-09T04:42:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=6973&amp;oldid=prev</id>
		<title>Mellinger: /* RandomSeed (optional) */</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=6973&amp;oldid=prev"/>
		<updated>2012-06-29T15:38:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;RandomSeed (optional)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:38, 29 June 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l31&quot;&gt;Line 31:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===RandomSeed (optional)===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===RandomSeed (optional)===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When a nonzero RandomSeed parameter is present at initialization time, the RandomGenerator class uses it as its random seed. Otherwise, it initializes itself from the current system time.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When a nonzero RandomSeed parameter is present at initialization time, the RandomGenerator class uses it as its random seed. Otherwise, it initializes itself from the current system time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In recent versions of BCI2000, the Operator module provides a global RandomSeed parameter for all modules, unless the RandomSeed parameter is specified on the command line, or otherwise by a core module at startup.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Remarks==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Remarks==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb-bci_:diff:1.41:old-4111:rev-6973:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=4111&amp;oldid=prev</id>
		<title>Mellinger at 12:48, 19 August 2008</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=4111&amp;oldid=prev"/>
		<updated>2008-08-19T12:48:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:48, 19 August 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Location==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Location==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;BCI2000/src/shared/utils&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/RandomGenerator&lt;/del&gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;tt&amp;gt;BCI2000/src/shared/utils&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Synopsis==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Synopsis==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb-bci_:diff:1.41:old-4103:rev-4111:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=4103&amp;oldid=prev</id>
		<title>Mellinger: /* Remarks */</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=4103&amp;oldid=prev"/>
		<updated>2008-08-19T12:39:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Remarks&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:39, 19 August 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===int operator()(int N)===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===int operator()(int N)===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Returns a pseudo random integer in the range from 0 to N-1. This function is a template, with the &amp;#039;&amp;#039;int&amp;#039;&amp;#039; type as a template parameter. It is provided to allow using an object of type &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; as a [http://www.sgi.com/tech/stl/functors.html functor], i.e. an object that may be used as if it were a function name. A typical application would be to specify a &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; object as a third argument to the STL&amp;#039;s [http://www.dinkumware.com/manuals/?manual=compleat&amp;amp;page=algorith.html#random_shuffle &amp;lt;tt&amp;gt;std::random_shuffle()&amp;lt;/tt&amp;gt;] function.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Returns a pseudo random integer in the range from 0 to N-1. This function is a template, with the &amp;#039;&amp;#039;int&amp;#039;&amp;#039; type as a template parameter. It is provided to allow using an object of type &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; as a [http://www.sgi.com/tech/stl/functors.html functor], i.e. an object that may be used as if it were a function name. A typical application would be to specify a &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; object as a third argument to the STL&amp;#039;s [http://www.dinkumware.com/manuals/?manual=compleat&amp;amp;page=algorith.html#random_shuffle &amp;lt;tt&amp;gt;std::random_shuffle()&amp;lt;/tt&amp;gt;] function.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==Parameters==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;===RandomSeed (optional)===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;When a nonzero RandomSeed parameter is present at initialization time, the RandomGenerator class uses it as its random seed. Otherwise, it initializes itself from the current system time.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Remarks==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Remarks==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb-bci_:diff:1.41:old-3915:rev-4103:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=3915&amp;oldid=prev</id>
		<title>Mellinger at 14:06, 26 June 2008</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Programming_Reference:RandomGenerator_Class&amp;diff=3915&amp;oldid=prev"/>
		<updated>2008-06-26T14:06:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Location==&lt;br /&gt;
&amp;lt;tt&amp;gt;BCI2000/src/shared/utils/RandomGenerator&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Synopsis==&lt;br /&gt;
The &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; class encapsulates a pseudo random number generator.&lt;br /&gt;
Each class instance maintains its own internal state; for a given random seed, this ensures identical number sequences across software elements that use pseudo random numbers.&lt;br /&gt;
&lt;br /&gt;
When a nonzero &amp;#039;&amp;#039;RandomSeed&amp;#039;&amp;#039; parameter is present at initialization time, the &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; class uses it as its random seed. Otherwise, it initializes itself from the current system time.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; is a descendant of the [[Programming Reference:EnvironmentExtension Class|&amp;lt;tt&amp;gt;EnvironmentExtension&amp;lt;/tt&amp;gt;]] class.&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
For each property, there is a getter method carrying the plain property name. Writable properties have an additional setter method prefixed with &amp;quot;Set&amp;quot;.&lt;br /&gt;
===int Seed (rw)===&lt;br /&gt;
A 32-bit value representing the random number generator&amp;#039;s internal state. On each iteration, the seed is replaced with the generator&amp;#039;s next state.&lt;br /&gt;
===int RandMax (r)===&lt;br /&gt;
An integer constant representing the maximum number returned from the &amp;lt;tt&amp;gt;Random()&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
==Events==&lt;br /&gt;
===Initialize===&lt;br /&gt;
In the &amp;#039;&amp;#039;Initialize&amp;#039;&amp;#039; event handler, the &amp;#039;&amp;#039;Seed&amp;#039;&amp;#039; property is initialized depending on whether a &amp;#039;&amp;#039;RandomSeed&amp;#039;&amp;#039; parameter is present in the system, and on its value.&lt;br /&gt;
When a nonzero &amp;#039;&amp;#039;RandomSeed&amp;#039;&amp;#039; parameter is present, it is used as a random seed. Otherwise, the seed is initialized from the current system time.&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
===int Random()===&lt;br /&gt;
Returns a pseudo random number in the range from 0 to, and including, RandMax.&lt;br /&gt;
===int operator()(int N)===&lt;br /&gt;
Returns a pseudo random integer in the range from 0 to N-1. This function is a template, with the &amp;#039;&amp;#039;int&amp;#039;&amp;#039; type as a template parameter. It is provided to allow using an object of type &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; as a [http://www.sgi.com/tech/stl/functors.html functor], i.e. an object that may be used as if it were a function name. A typical application would be to specify a &amp;lt;tt&amp;gt;RandomGenerator&amp;lt;/tt&amp;gt; object as a third argument to the STL&amp;#039;s [http://www.dinkumware.com/manuals/?manual=compleat&amp;amp;page=algorith.html#random_shuffle &amp;lt;tt&amp;gt;std::random_shuffle()&amp;lt;/tt&amp;gt;] function.&lt;br /&gt;
&lt;br /&gt;
==Remarks==&lt;br /&gt;
The number sequence is generated using a standard linear congruential algorithm, with its parameters chosen as suggested in [http://www.ams.org/mcom/1999-68-225/S0025-5718-99-00996-5/S0025-5718-99-00996-5.pdf P. L&amp;#039;Ecuyer: A table of linear congruential generators of different sizes and good lattice structure. Mathematics of Computation, 68(225), 1999].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Programming Reference:ApplicationBase Class]], [[Programming Reference:EnvironmentExtension Class]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Framework API]][[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Mellinger</name></author>
	</entry>
</feed>