<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qetlab.com/wiki/index.php?action=history&amp;feed=atom&amp;title=RandomProbabilities</id>
	<title>RandomProbabilities - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qetlab.com/wiki/index.php?action=history&amp;feed=atom&amp;title=RandomProbabilities"/>
	<link rel="alternate" type="text/html" href="https://qetlab.com/wiki/index.php?title=RandomProbabilities&amp;action=history"/>
	<updated>2026-06-23T11:03:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://qetlab.com/wiki/index.php?title=RandomProbabilities&amp;diff=679&amp;oldid=prev</id>
		<title>Nathaniel: Created page with &quot;{{Function |name=RandomProbabilities |desc=Generates a random probability vector |rel=RandomStateVector |cat=Random things |upd=Decembe...&quot;</title>
		<link rel="alternate" type="text/html" href="https://qetlab.com/wiki/index.php?title=RandomProbabilities&amp;diff=679&amp;oldid=prev"/>
		<updated>2014-12-17T21:14:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Function |name=RandomProbabilities |desc=Generates a random probability vector |rel=&lt;a href=&quot;/RandomStateVector&quot; title=&quot;RandomStateVector&quot;&gt;RandomStateVector&lt;/a&gt; |cat=&lt;a href=&quot;/List_of_functions#Random_things&quot; title=&quot;List of functions&quot;&gt;Random things&lt;/a&gt; |upd=Decembe...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Function&lt;br /&gt;
|name=RandomProbabilities&lt;br /&gt;
|desc=Generates a random probability vector&lt;br /&gt;
|rel=[[RandomStateVector]]&lt;br /&gt;
|cat=[[List of functions#Random_things|Random things]]&lt;br /&gt;
|upd=December 2, 2014}}&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;RandomProbabilities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt; is a [[List of functions|function]] that generates a random probability vector (i.e., its entries are non-negative and sum to 1), uniformly distributed on the unit simplex.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
* &amp;lt;tt&amp;gt;P = RandomProbabilities(N)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Argument descriptions==&lt;br /&gt;
* &amp;lt;tt&amp;gt;N&amp;lt;/tt&amp;gt;: The number of entries in the desired probability vector.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Uniform distribution of length-3 probability vectors===&lt;br /&gt;
The following code randomly generates 10000 probability vectors of length 3, and then demonstrates that their distribution on the unit simplex really is approximately uniform:&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; for j = 1:10000&lt;br /&gt;
     p(j,:) = RandomProbabilities(3);&lt;br /&gt;
   end&lt;br /&gt;
&amp;gt;&amp;gt; scatter3(p(:,1),p(:,2),p(:,3),1) % plot the probability vectors in 3D-space&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scatter plot produced by the above code is displayed below:&lt;br /&gt;
&lt;br /&gt;
[[File:RandomProbabilities_uniform.png]]&lt;br /&gt;
&lt;br /&gt;
{{SourceCode|name=RandomProbabilities}}&lt;/div&gt;</summary>
		<author><name>Nathaniel</name></author>
	</entry>
</feed>